0

I have an email that pulls the contents of an RSS Feed and places it in the body of an email. This is done directly in the email rather than a content area.

This is all working just fine but I'd also like to have the subject of the email include the top headline of said RSS feed.

I've created a content area with the following code for the subject line:

%%[

Var @xml, @titles, @title, @cnt 
Set @xml = ContentAreaByName("my contents\RSSParse\RSSParse") 
Set @titles = BuildRowsetFromXML(@xml,"//item/title",1) 

If RowCount(@titles) >= 1 THEN 
  SET @rows = 1 
ELSE 
   SET @rows = RowCount(@titles) 
ENDIF 

IF @rows >= 1 THEN 

  for @cnt = 1 to @rows do 
    Set @title = Field(Row(@titles,@cnt),"Value")
    ]%%
    %%=v(@title)=%%
    %%[
  NEXT @cnt 

ENDIF
]%%

The subject line contains the following call:

%%=ContentAreaByName("My Contents\RSSParse\Subjectline")=%%

When I test send the email, the subject line pulls a title fine. However, on actual sends, the subject line is blank.

  • How do you expect anyone to help when you don't provide the code in the content areas you're referencing? – Adam Spriggs May 23 '16 at 18:47
  • Hey @AdamSpriggs, I did.I wrote "I've created a content area with the following code:" with all the code under it? Is it not showing up? – Something is missing May 23 '16 at 19:20
  • And the code for the Subjectline content area? – Adam Spriggs May 23 '16 at 20:04
  • I think I see the confusion with my phrasing. My bad. I the body of the email doesn't pull from a CA, it is just written in the email itself. – Something is missing May 23 '16 at 20:07
  • There are two content areas one to pull the rss feed (get http etc.) and the second for the subject line. That's what posted above. – Something is missing May 23 '16 at 20:07
0

Parsing RSS feed content at send time is a very fragile way to build these types of emails. I would not recommend it.

I think it's better to write a SSJS Script Activity to pull data with httpget() from the feed URL, parse it and store it in a Data Extension. (Script Activities must be enabled by SFMC Support.)

Then you can add the Script Activity to an Automation in Automation Studio to refresh the Data Extension on some interval.

In the email you can simply retrieve the Data Extension row using one of the AMPScript Lookup functions.

Having the retrieval of external content outside of the email provides you an opportunity to verify it's getting retrieved properly before it's used.

You can probably still utilize your RSSParse Content Area in the Script Activity.

| improve this answer | |
  • 1
    This. A thousand times this. – Gortonington May 24 '16 at 12:51
  • If this answer has solved your question please consider accepting it by clicking the check-mark on the left. It might help people experiencing a similar issue and will help getting your question noticed. For more information, take a look at our FAQ. – Adam Spriggs May 27 '16 at 10:39
-1

In your subject field write

%%=v(@subjectline)=%%

Anywhere in your email code, whether in a content area or not, set this value:

SET @subjectline = xxx
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.