Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email.Headers.Add("Bcc"…) does not do what one might think #134

Open
quite opened this issue Dec 16, 2020 · 3 comments
Open

Email.Headers.Add("Bcc"…) does not do what one might think #134

quite opened this issue Dec 16, 2020 · 3 comments

Comments

@quite
Copy link

quite commented Dec 16, 2020

If you do Email.Headers.Add("Bcc", "[email protected]"), you don't get a BCC to that address, but instead an email to the To:, which has a visible header Bcc: [email protected]. Perhaps this is by design? But Email.Headers.Add("To", "[email protected]") for example does override Email.To.

@bosim
Copy link
Contributor

bosim commented Dec 29, 2020

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.

@quite quite changed the title Email.Headers.Add("Bcc" does do what one might think Email.Headers.Add("Bcc"…) does not do what one might think Dec 30, 2020
@quite
Copy link
Author

quite commented Dec 31, 2020

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.

@bosim
Copy link
Contributor

bosim commented Jan 2, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants