2

I am using Postal.NET for email in my C# MVC application:

http://aboutcode.net/postal/

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);

Benjamin E.
  • 5,042
  • 5
  • 38
  • 65
Abhi
  • 29
  • 3

1 Answers1

2

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: lolcats@website.com
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: lolcats@website.com
Subject: Important Message

Hello,
You wanted important web links right?
Check out this: @ViewBag.FunnyLink

<3
scotru
  • 2,563
  • 20
  • 37