Include Content from an RSS Feed in an Email Message
RSS feeds are XML-based lists of the latest articles published on a website or other content source. You can use AMPscript to pull content from an RSS feed and add that content to an email message. An advantage of this approach is that AMPscript retrieves content from the RSS feed at send time, ensuring that the content you add to the email is as current as possible.
In this example, the AMPscript takes the five most recent 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 after adding five articles to the message.
In the body of the email message, include this code example.
You can modify the HTML in the example to fit the formatting of your email message. To make sure that the message pulls the correct content and that the content is formatted correctly, always send emails before you send to your customers.
If the RSS feed contains HTML formatting, remove any AMPscript from the text version of the email, and provide the VAWP URL. If you don’t make these changes, the email fails.
If you reference a node that includes a colon, the AMPscript function returns an error. This code example uses the Replace() function to remove the colon so that you can successfully add content from your RSS feed to your emails.