Adding Custom Email Headers

Kashif Akram asked on September 8, 2021 02:06

Hi Everyone,

I am using AWS SES as a SMTP and using on several Kentico sites. Problem is when you have 10% email bounced aws blocks your account which has happend to me, trying to setup Cloudwatch to receive SES bounced notifications, that requires to add custom email headers (specific to SES).

I found that I can add headers to email mesage using msg.Headers.Add function but not sure how to add in email template.

If anyone could guide where to add custom email headers in email template or settings or body I'd appreciate that.

Thanks, Kashif

Recent Answers


Dmitry Bastron answered on September 8, 2021 06:21

Hi Kashif,

The only place I can think of where you can add custom email headers is a custom Email Provider. In it's SendEmailInternal and SendEmailAsyncInternal methods you should be able to do so. Bear in mind this email provider code will be executed for all emails sent in the system and you won't be able to limit these headers only to a specific template. However, you can write some logic based on sender and recipient information which could be helpful.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.