Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Typology Rule for adding SMTP header

Avatar

Level 3

Hi,

I've implemented a List-Unsubscribe into a delivery template in the 'Additional SMTP headers' section.
It did work as expected but since I want it in all my delivery templates I wish to add it using a Typology rule.
I saw in the documentation that it is possible but couldn't figure out exactly how to do it using a Typology rule.

Does someone know how it can be achieved?

Thanks,

Sagi

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Sagi,

You can use a code inside typology rule

delivery.mailParameters.headers inside the JS code will give you all the headers.

If you do a split

var headerLines = headers.split("\n");

you get an array of headers.

Create your custom header as

var newHeaderLine = header + ": " + value;

Add the new header line to the array

headerLines.push(newHeaderLine);

Finally, join them and assign to the main parameter

delivery.mailParameters.headers = headerLines.join("\n")

Regards,
Vipul

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Hi Sagi,

You can use a code inside typology rule

delivery.mailParameters.headers inside the JS code will give you all the headers.

If you do a split

var headerLines = headers.split("\n");

you get an array of headers.

Create your custom header as

var newHeaderLine = header + ": " + value;

Add the new header line to the array

headerLines.push(newHeaderLine);

Finally, join them and assign to the main parameter

delivery.mailParameters.headers = headerLines.join("\n")

Regards,
Vipul

Avatar

Level 3

Hi Vipul,

I want to add a list unsubscribe header by using a typology rule useing this snippet.

There seems to be something wrong with the syntax, could you please look into this?

delivery.mailParameters.headers

var headerLines = headers.split("\n");

var newHeaderLine = header + ":mailto: " + errorAddress + "?subject=unsubscribe" + message.mimeMessageId;

headerLines.push(newHeaderLine);

delivery.mailParameters.headers = headerLines.join("\n")

Best regards

Niels