Custom Headers

Table of Contents:


How to Add Custom X-Headers to Outgoing Email Messages

This feature enables marketers to dynamically add / insert / inject a custom header into the header of every email message sent via this connection!

Custom headers are also known as custom x-headers.

(warning) This feature is not to be used for implementing List-Unsubscribe Headers. See our List-Unsubscribe Header  for more info about that. 

  1. Go to: Vendor Settings → My Connections

  2. Under the 'Actions' column select "ESP setup" for the relevant connection.
  3. Open the 'Custom Headers' panel, click on the '+ Add custom header' button.


  4. Add the desired custom header e.g.:

Here's a snippet of an email message header with the above custom header added to the outbound email message:

X-HEADER-NAME: marketing
From: some_name <newsletter@somecompany.com>
Subject: Newsletter
Reply-To: newsletter@somedomain.com
Return-Path: bounces-3249@somesmtp.com
Content-Type: multipart/alternative;
    boundary="_----3WwrS01AbB9izOtvaHw===_2F/B6-162-06C7F5"

What values can be injected into a custom header

  1. Literal value e.g., 10, IP-Pool, etc.
  2. Ongage System Field e.g., {{ocx_mailing_id}}
  3. Ongage Dynamic List Field e.g., {{channel_id}} (where channel_id is a data field in your Ongage list). 

How to send an MD5 hashed email in a custom header

You can have an MD5 email in the custom X-header when sending through a particular connection by following steps shared below.

  1. Add a custom header in the ESP connection as explained in above section i.e. How to Add Custom X-Headers to Outgoing Email Messages.
  2. While adding Custom header use any name of your choice, For example “X-HEADER-md5”.
  3. Under Value use “{{ocx_custom_hash}}”.


  4. While sending campaign, please add "{{ocx_generate_hash{algo=md5,data=\{{email}}}}}"​ as the first line in the body of your Email Message and use the ESP Connection in which you have configured Custom Header.
  5. Once above steps are done, the MD5 hashed email will be populated as Custom Header in your campaign.       

Appendix 

How to view an email message header

Outlook:

  1. Open email message.
  2. Click on the 'File' tab.
  3. Click on 'Properties'.
  4. View the 'Internet headers'.

Gmail:

  1. Open email message.
  2. From message 'more' menu click on 'Show original'.
  3. View all message headers in new tab window that opened from the above.

Mail-Tester:

  1. Send an email message from Ongage to Mail-Tester (using our free built-in feature).
  2. View header under the 'Source' panel:

The X-Header replacement tag

This feature is mostly deprecated and superseded by the above setting in the vendor connection setup page.

The only time you might still need this is if you'd like to set this value on a per campaign basis, in which case you'll need to add the following replacement tag in the body of your email message.

(warning) Using this feature will add an additional header. It does not overwrite the one set in the connection as detailed above.


Place the following replacement tag in the body of your HTML email message:

[[esp-id:header_X-SOME-HEADER-NAME:<value>]]

Ongage will remove this tag from the body of the email message prior to sending, and inject X-SOME-HEADER-NAME: <value> into the header of the email message.

For example:

Placing the following in the body of the email message:
[[4:header_X-SOME-HEADER-NAME:marketing]]

Will inject the following X-Header for all emails sent via Amazon SES connections:
X-SOME-HEADER-NAME:marketing

Using If-then-else in X-Header replacement tag

The "if-then-else" conditions can also be used as part of the Email X-Header replacement Tag.
Below example of where "email_key" is your list field and "ocx_campaign_name" is the system field. Here system will look at "email_key" first and if it is empty then will pick up the Campaign name. 

[[0:header_X-SOME-HEADER-NAME:{{ocx_if email_key !is empty}}{{email_key}}{{ocx_else}}{{ocx_campaign_name}}{{ocx_endif}}]]


(info) Note: Instead of esp-id you can use the ID – the ESP Connection ID number that appears in your "My Connections" screen as illustrated below:


(info) Moreover, you can also use 0 e.g., ESP ID 0: [[0:header_X-SOME-HEADER-NAME:header-value]] and then it will inject that X-header in all SMTP vendors that we support this feature.