Typology Rule for adding SMTP header

sagil23995776

20-08-2018

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

Accepted Solutions (1)

Accepted Solutions (1)

Vapsy

Employee

20-08-2018

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

Answers (2)

Answers (2)

nielsr72948361

10-04-2019

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