Skip to content

Commit

Permalink
Don't enforce return path, and check for leading <
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbanham committed Jun 15, 2022
1 parent 5451b61 commit 258e0d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mime.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ func (email Email) WriteMime(dest io.Writer) error {
dest.Write([]byte("From: " + email.From + "\r\n"))
dest.Write([]byte("To: " + email.To + "\r\n"))
if email.ReturnPath != "" {
dest.Write([]byte("Return-Path: <" + email.ReturnPath + ">\r\n"))
} else {
dest.Write([]byte("Return-Path: <" + email.From + ">\r\n"))
if email.ReturnPath[0] == "<" {
dest.Write([]byte("Return-Path: " + email.ReturnPath + "\r\n"))
} else {
dest.Write([]byte("Return-Path: <" + email.ReturnPath + ">\r\n"))
}
}
if email.ReplyTo != "" {
dest.Write([]byte("Reply-To: " + email.ReplyTo + "\r\n"))
Expand Down

0 comments on commit 258e0d1

Please sign in to comment.