This documentation aims to explain how to add an expiration date in the SMTP headers of your emails sent from Adobe Campaign Classic. To learn what an SMTP header is, don’t hesitate to read this article.
As a reminder, as defined in the technical specifications (https://datatracker.ietf.org/doc/draft-ietf-mailmaint-expires/), the header has this format:
Expires: Wed, 1 Dec 2021 17:22:57 +0000
To define the expiration date, you simply need to modify the date given in the example to give it a value in the near future (for example, when your promotion will end).
Adding an expiration date manually
Adding an expiration date can be done in a few clicks.
In your delivery, click on “Properties”
In the properties, go to the SMTP tab and add your “Expires” header in the “Additional SMTP headers” field. Don’t forget to customize the date.
Adding an expiration date automatically to your deliveries
Automatically Add an Expiration Date to Your Broadcasts
Method 1: JavaScript Directly in the SMTP Header
Directly in the SMTP tab of your broadcast templates, add this JS formula (example for a 60-day expiration date):
Expires: <% var date = new Date(); date.setDate(date.getDate() + 60); %><%= formatDate(date, “%a, %d %b %Y %H:%M:%S”) %> +0000
In the formula, the +60 sets the expiration date to 60 days from today. For an email sent on June 13, 2024, the result in the email header would be:
It is possible to extend or shorten this period, for example to 175 days:
<% var date = new Date(); date.setDate(date.getDate() + 175); %><%= formatDate(date, “%a, %d %b %Y %H:%M:%S”) %> +0000
Finally, you can create multiple broadcast templates with different expiration dates depending on the type of campaign, which will have the desired expiration date directly, so you don’t have to modify this period each time.
Method 2: Via Enrichment
In the targeting workflow, through enrichment, we will define the expiration date as X months, days, or years as needed. In our example, an expiration date is set to 6 months after the send date:
In this enrichment, we will calculate a date + 6 months from the current date using a formula in the expression.
Choose “Edit formula from expression.”
In the expression editor, open the “Date” functions, then set the date to 6 months from the current date:
This results in the following type of expression:
Save and rename the label and alias (in my example, I named this date “Date_Expiration” to easily find it for configuration in the SMTP:
As a result, this gives (Workflow launch date on June 7, 2024):
In the SMTP, implement this formula which will adapt the date format as agreed (and in English):
<%= formatDate(targetData.Date_Expiration, « %Ai, %D %Bi %4Y %02H:%02N:%02S » ) %>
Via targetData.Date_Expiration, I retrieve my previously calculated expiration date, then adapt this format: %Ai = day of the week in English %D = day number %Bi = month in English %4Y = year in 4 digits %02H= hour in 2 digits %02N= minutes in digits %02S = seconds in digits.
More info on the JS date format through the documentation below: https://experienceleague.adobe.com/developer/campaign-api/api/f-formatDate.html
This will then result in the SMTP:
At the time of sending, this will set the expiration date in the SMTP to 6 months as requested in the enrichment in the desired format, example in an email header:
The automation of the expiration date is obviously adaptable, by “playing” with the advanced functions offered by Adobe to adapt expiration dates according to the type of campaign, for example:
- if we want an end date 1 month after sending: AddMonths(GetDate(),1 )
- an end date 15 days after sending: AddDays(GetDate(),15 )
- an end date a few hours later, 4 hours in the example: AddHours(GetDate(),4)
Another possibility is to calculate this date format in JS directly in the SMTP (I have not yet completely succeeded in doing so, it is in progress).
Contributors
- Matthieu Bonnet, SNCF Connect
- Geoffrey Duchefdelaville, La Poste Groupe
- Jonathan Loriaux, Badsender
- Gabriel Créa, Accenture
- Arthur Le Bris, SEJER
If you want to contribute to this documentation, don’t hesitate to contact us
Recent Comments