diff options
Diffstat (limited to 'SendGrid/SendGridMail/SendGrid.cs')
-rwxr-xr-x | SendGrid/SendGridMail/SendGrid.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/SendGrid/SendGridMail/SendGrid.cs b/SendGrid/SendGridMail/SendGrid.cs index b473d5d..b1a38aa 100755 --- a/SendGrid/SendGridMail/SendGrid.cs +++ b/SendGrid/SendGridMail/SendGrid.cs @@ -49,6 +49,7 @@ namespace SendGridMail {
message = new MailMessage();
Header = header;
+ Headers = new Dictionary<string, string>();
From = from;
To = to;
@@ -65,6 +66,7 @@ namespace SendGridMail {
message = new MailMessage();
Header = header;
+ Headers = new Dictionary<string, string>();
//initialize the filters, for use within the library
this.InitializeFilters();
@@ -83,6 +85,22 @@ namespace SendGridMail }
}
+ public MailAddress[] ReplyTo
+ {
+ get
+ {
+ return message.ReplyToList.ToArray();
+ }
+ set
+ {
+ message.ReplyToList.Clear();
+ foreach (var replyTo in value)
+ {
+ message.ReplyToList.Add(replyTo);
+ }
+ }
+ }
+
public MailAddress[] To
{
get
@@ -143,6 +161,7 @@ namespace SendGridMail }
}
+ public Dictionary<String, String> Headers { get; set; }
public IHeader Header { get; set; }
public String Html { get; set; }
public String Text { get; set; }
@@ -273,6 +292,11 @@ namespace SendGridMail var rcpts = tos.Union(ccs.Union(bccs)).Select(address => address.Address);
return rcpts;
}
+
+ public void AddHeaders(IDictionary<string, string> headers)
+ {
+ headers.Keys.ToList().ForEach(key => Headers[key] = headers[key]);
+ }
#endregion
#region SMTP API Functions
@@ -430,6 +454,8 @@ namespace SendGridMail if (!String.IsNullOrEmpty(smtpapi))
message.Headers.Add("X-Smtpapi", smtpapi);
+ Headers.Keys.ToList().ForEach(k => message.Headers.Add(k, Headers[k]));
+
if(Attachments != null)
{
foreach (Attachment attachment in Attachments)
|