I've written scripts that extract email lifecycle information from Salesforce Marketing Cloud's SOAP API, but am unable to find a way to get email subjects for each subscriber after AMPscript has been processed.

Essentially, I use the API to get from Campaigns to Emails to Sends, and then get all the events (SentEvent, ClickEvent, BounceEvent, etc.) for all the Sends. Each of these events is then stored in a separate database, alongside related information (subscriber email, campaign name, email subject, and some other data).

This works quite well, and I'm able to get all the information I need except for rendered email subject. Many emails have dynamic subject lines with AMPscript in them, for example %%[ IF PROP_A == \"foo\" OR PROP_B == \"bar\" THEN ]%% subject 1 %%[ ELSE ]%% subject 2 %%[ ENDIF ]%%. When I say "rendered email subject", I mean that I'm interested in obtaining the subject as actually sent to the particular subscriber of that event. So for subscriber A the subject may be "subject 1", and for B it may be "subject 2".

The subject attribute of both Send and Email only have the AMPscript, which makes sense since those objects are not specific to any one subscriber. Unfortunately, none of the event-related objects (SentEvent, etc.) have a rendered subject, either. This makes some sense since it would be redundant across all events. However, for the life of me I cannot find any objects that would logically hold information like the subject as a particular subscriber receives it.

Does such an object or attribute exist somewhere I'm not seeing? If not, are there any other approaches to get this data?

1 Answer 1


I think unless you collect them inside the send log (by setting the subject via an AMPScript variable) then there is no simple solution and no way to gather it at send time.

Your best bet would likely be to:

  1. Grab the subject out from the dataviews you mentioned in your question and save it to a reference DE (likely via SQL query)
  2. On a Cloudpage/Landing page (or Script activity for automation) lookup these values from DE
  3. Then render the collected subject lines against each corresponding list/DE
  4. Upsert the rendered subject line to your final reference DE that needs to contain them.

You can then add this process into an Automation and have it run at a schedule to collect each subjectline after the sends.

This is far from an elegant solution and is resource heavy, but to my knowledge the final rendered subject for each individual send is not stored anywhere in SFMC.

Hopefully someone else knows something better, but this is the best solution I have found.

  • Thanks for the details! This would seem to confirm my hunch that there is no straightforward way to do this.
    – Talos
    Commented Apr 12, 2018 at 13:54

You must log in to answer this question.

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