Include an RSS Feed in an Email Message

Use AMPscript to pull content from an RSS feed and put that content into an email message. RSS presents an XML-based list that showcases the latest articles published on a website or other RSS-enabled content source. 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.

Prerequisites

Familiarize yourself with the email creation process and AMPscript before attempting to use the information in this document. You must also publish an operational RSS feed to the Internet before you can use it in an email.

Scenario

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. Example

Sample AMPscript

In the email message content area, include this sample AMPscript:

Test the email before sending to make sure the message pulls the correct content.

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 pulls 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, clear the text version of any AMPscript and provide the VAWP URL as a mechanism to view the email. If you don't do this, the email send will fail.

If you reference a node that includes a colon, the parser will not accept that colon and cause the operation to error out. Use this sample code as an example to get around the colon and successfully add your RSS feed: