mirror of
https://github.com/mjl-/mox.git
synced 2025-07-19 00:46:36 +03:00
fix parsing message headers with addresses that need double quotes
we are using Go's net/mail to parse message headers. it can parse addresses, and properly decodes email addresses with double quotes (e.g. " "@example.com). however, it gives us an address without the double quotes in the localpart, effectively an invalid address. we now have a workaround to parse such not-quite-addresses. for issue #199 reported by gene-hightower, thanks for reporting!
This commit is contained in:
@ -201,7 +201,11 @@ binary should be setgid that group:
|
||||
if len(addrs) != 1 {
|
||||
log.Fatalf("only single address allowed in To header")
|
||||
}
|
||||
recipient = addrs[0].Address
|
||||
addr, err := smtp.ParseNetMailAddress(addrs[0].Address)
|
||||
if err != nil {
|
||||
log.Fatalf("parsing address: %v", err)
|
||||
}
|
||||
recipient = addr.Pack(false)
|
||||
}
|
||||
}
|
||||
if k == "to" {
|
||||
|
Reference in New Issue
Block a user