Typology Rule for adding SMTP header | Community
Skip to main content
Level 3
August 20, 2018
Solved

Typology Rule for adding SMTP header

  • August 20, 2018
  • 3 replies
  • 5063 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vraghav

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

3 replies

vraghav
Adobe Employee
vraghavAdobe EmployeeAccepted solution
Adobe Employee
August 21, 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

Level 3
August 21, 2018

Hi Vipul,
Thanks for your answer, it helped

Cheers,

Sagi

nielsr72948361
Level 2
April 10, 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