Open quite opened 3 years ago
I think the library is working correctly as long as you use Email.Bcc = []string{...}
then it is being put in SMTP RCPT TO:
but not in the mail header part.
See e.g. https://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server/26611044
But I didn't test it.
Your reasoning is sound.
I was mostly thinking that if adding To-header by Headers.Add() does overrides envelope-To set earlier, then perhaps Bcc should too.
I didn't think of this, since I read most of email.go
, I could remember the logic from there It makes sense. I am not sure it will work ovewriting "To" header, since Email.To
is still used as RCPT TO
. Should be pretty easy to test, using Email.To = []string{}
and setting Email.Headers["To"]
to something. It will fail.
If you do
Email.Headers.Add("Bcc", "foo@example.com")
, you don't get a BCC to that address, but instead an email to theTo:
, which has a visible headerBcc: foo@example.com
. Perhaps this is by design? ButEmail.Headers.Add("To", "bar@example.com")
for example does overrideEmail.To
.