Skip to content

Commit

Permalink
added all possible headers
Browse files Browse the repository at this point in the history
  • Loading branch information
alash3al committed Jun 6, 2020
1 parent b2c4cb9 commit 15c54ed
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,30 @@ func main() {

req := resty.New().R()

// set the url-encoded-data
req.SetFormData(map[string]string{
formData := map[string]string{
"id": msg.MessageID,
"date": msg.Date.String(),
"subject": msg.Subject,
"body[text]": string(msg.TextBody),
"body[html]": string(msg.HTMLBody),
"addresses[from]": c.From().Address,
"addresses[to]": strings.Join(extractEmails(msg.To), ","),
"addresses[reply-to]": strings.Join(extractEmails(msg.ReplyTo), ","),
"addresses[resent-to]": strings.Join(extractEmails(msg.ResentTo), ","),
"addresses[resent-cc]": strings.Join(extractEmails(msg.ResentCc), ","),
"addresses[resent-bcc]": strings.Join(extractEmails(msg.ResentBcc), ","),
"addresses[resent-from]": strings.Join(extractEmails(msg.ResentFrom), ","),
"addresses[in-reply-to]": strings.Join(msg.InReplyTo, ","),
"addresses[cc]": strings.Join(extractEmails(msg.Cc), ","),
"addresses[bcc]": strings.Join(extractEmails(msg.Bcc), ","),
"resent-date": msg.ResentDate.String(),
"resent-id": msg.ResentMessageID,
"references": strings.Join(msg.References, "m"),
"spf_result": strings.ToLower(spfResult.String()),
})
}

// set the url-encoded-data
req.SetFormData(formData)

// set the files "attachments"
for i, file := range msg.Attachments {
Expand Down

0 comments on commit 15c54ed

Please sign in to comment.