Reputation: 39
I am using Postal.NET for email in my C# MVC application:
I am using SendGrid for sending out emails. Sendgrid requires custom header arguments to be sent using the "X-SMTPAPI" header attribute.
How can I add custom header values in Postal.NET? (e.g. myMessage.Headers.Add("X-SMTPAPI", jsonString);
Upvotes: 3
Views: 683
Reputation: 2606
I haven't used this library, but it looks to me like you can just add headers in the view above the email. That is the view you create contains the entire email--including headers. In the documentation you can see that To: and From: are included in the view. This is from the documentation:
To: @ViewBag.To
From: [email protected]
Subject: Important Message
Hello,
You wanted important web links right?
Check out this: @ViewBag.FunnyLink
<3
So I think you could likely do something like:
X-SMTPAPI: @ViewBag.jsonAPIString
To: @ViewBag.To
From: [email protected]
Subject: Important Message
Hello,
You wanted important web links right?
Check out this: @ViewBag.FunnyLink
<3
Upvotes: 3