4

I've created an email using ampscript that pulls in the latest blog posts from an RSS feed. I would like to automate the sending of this email on a daily basis. This blog may have days where there is not a post, and I don't want to send out duplicate content so it's important that the email doesn't get sent if there hasn't been a new post.

Is there a way (using ampscript) to make sure that the email will not send if there have been no new posts on the blog in the past day?

1 Answer 1

3

There are several ways to do this, but most of them will still charge you for the send once email generation is underway. The BEST way is you need to contact support and/or your account representative and get Audience Exclusion scripts enabled under your account (not standard). This will show up when you create a User Initiated Send. A new text area will show up at the bottom, where you can write a one line ampscript expression that evaluates to boolean. If its true, the email doesn't go out. Otherwise, it does.

4
  • ,any code snippets? Commented Apr 12, 2014 at 12:31
  • Sure. For a particular client I have a list of hashed email addresses that serve as the unsubscribe/exclusion list. My audience exclusion script is: %%[ RowCount(LookupRows("Exclude_Customers", "HashedEmailAddress", SHA256(emailaddr))) > 0 ]%% , where "Exclude_Customers" is the data extension, and "HashedEmailAddress" is the column of interest.
    – Timothy
    Commented Apr 14, 2014 at 15:04
  • Thanks, this is helpful. I see how that would exclude subscribers on a data extension. How would this apply to an RSS feed though? I suppose I could evaluate the date on the latest item in the feed and set the boolean value based on if it is new or not. Does the Audience Exclusion field support Httpget and IF statements? (Sorry if this is obvious, I'm fairly new with AmpScript).
    – Rick
    Commented Apr 17, 2014 at 19:34
  • 1
    I had exclusion scripts enabled on my account and here is the solution that I used to prevent emails from going out if the latest post in the feed was over 24 hours old (which will be our sending schedule): %%[DateDiff(Field(Row(BuildRowsetFromXML(HTTPGet("http://example.com/rss.xml"),"//item/pubDate",1),1),"Value"),now(),"H") > 24]%% After an initial send to a test list, it seemed to work fine.
    – Rick
    Commented Apr 24, 2014 at 21:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .