This document contains conceptual, procedural and scenario information about including RSS feeds in the content of an email message. You can use AMPscript to pull content from an RSS feed and put that content into an email message
You must be familiar with the email creation process and AMPscript before attempting to use the information in this document. Your RSS feed must also be operational and published to the Internet before you can use it in an email.
RSS presents an XML-based list that showcase the latest articles published on a website or other RSS-enabled content source. You can use AMPscript to take the information from an RSS feed during the send to make sure you include the most current information possible in your email send.
Northern Trail Outfitters maintains a blog for several key employees to use in sharing their experiences with Northern Trail equipment and the outdoors. They also send out a weekly email newsletter, and they'd like to include links to the latest blog entries as part of the newsletter. They use AMPscript to pull the RSS feeds into the email at the time of send.
Follow the procedures below to include an RSS feed in your email sends.
%%before; httpget; 1 "(INSERT URL HERE)"%%%%[Var @xml, @titles, @title, @descs, @desc, @links, @link, @cnt
Set @xml = TreatAsContent(ContentAreaByName("my contents\RSSParse\RSSParse"))
Set @titles = BuildRowsetFromXML(@xml,"//item/title","false")
Set @descs = BuildRowsetFromXML(@xml,"//item/description","false")
Set @links = BuildRowsetFromXML(@xml,"//item/link","false")
for @cnt = 1 to 5 do
Set @title = Row(@titles,@cnt)
Set @desc = Row(@descs,@cnt)
Set @link = Row(@links,@cnt) ]%%
<div style="border: 1px solid #444; background-color: #F7F7F7; margin: 0.76em 0; padding: 0.76em;">
<h1 style="font: bold normal 1.0em Arial, Helvetica, sans-serif;"><a href='%%= RedirectTo(Field(@link,"Value")) =%%' alias='%%= Field(@title,"Value") =%%' title='%%= Field(@title,"Value") =%%' style="color: #000;">%%= Field(@title,"Value") =%%</a></h1>
<span style="font: normal normal 0.76em Arial, Helvetica, sans-serif; color: #444;">%%= Field(@desc,"Value") =%%</span>
</div>
%%[ next @cnt ]%% In the AMPscript listed above, the AMPscript takes the most recent 5 entries from the feed and includes them in the email. The @xml variable pull in the content area with the content syndication, while the other variables pull information from the feed to include in the email. The For loop in the email counts how many times articles have been pulled from the feed and stops the message at 5.
You can modify the HTML markup included in the example to better fit the formatting of your email message.
If the RSS Feed pulled into the email contains HTML formatting, be sure to clear the text version of any AMPscript and provide the VAWP URL as a mechanism to view the email. If you do not do this, the email send will fail.