xhit/go-simple-mail

email.GetMessage not return Bcc address ?

andiksetyawan opened this issue · 3 comments

i need get full msg for append to draft mailbox.

xhit commented

Bcc and Return-Path are ignored in header to avoid expose that addresses.

If you want really the full message, you need replace in email.go

- // add all addresses to the headers except for Bcc and Return-Path
+ //  add all addresses to the headers
-		if header != "Bcc" && header != "Return-Path" {
-			// add the address to the headers
+ email.headers.Add(header, address.String())
-		}

I will consider a new API to get the full message.

Ok. Thanks. and maybe I have a suggestion for the content type / mime type of the attach file, it's safer to use http.DetectContentType() instead of using the extension string.

xhit commented

I have a suggestion for the content type / mime type of the attach file, it's safer to use http.DetectContentType() instead of using the extension string.

Maybe file another issue and if you have some benchmarks. Developers can add a custom mime type, so maybe can use http.DetectContentType() and pass the result to File struct.