Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Typesafe.Mailgun/FormPartsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,22 @@ public static List<FormPart> Build(MailMessage message, IDictionary<string, IDic
}
}

result.AddRange(message.Attachments.Select(attachment => new AttachmentFormPart(attachment)));
// Check for the existense of Mailgun delayed send headers
if (message.Headers.AllKeys.Contains("X-Mailgun-Deliver-By"))
{
// Grab the Mailgun tag header values
var tagHeaders = message.Headers.GetValues("X-Mailgun-Deliver-By");
if (tagHeaders != null)
{
// Iterate over the collection and add each tag header to the result
foreach (var tag in tagHeaders)
{
result.Add(new SimpleFormPart("o:deliverytime", tag));
}
}
}

result.AddRange(message.Attachments.Select(attachment => new AttachmentFormPart(attachment)));

return result;
}
Expand Down