internal Mail(IHeader header) { _message = new MailMessage(); Header = header; Headers = new Dictionary<string, string>(); TextTransferEncoding = TransferEncoding.SevenBit; HtmlTransferEncoding = TransferEncoding.SevenBit; }
public void TestAddHeader() { var test = new Header(); test.AddSubVal("foo", new List<string> { "a", "b" }); var mime = new MailMessage(); test.AddHeader(mime); var result = mime.Headers["x-smtpapi"]; Assert.AreEqual("{\"sub\" : {\"foo\" : [\"a\", \"b\"]}}", result); }
/// <summary> /// Attaches the SendGrid headers to the MIME. /// </summary> /// <param name="mime">the MIME to which we are attaching</param> public void AddHeader(MailMessage mime) { mime.Headers.Add(SendGridHeader, AsJson()); }