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

Do not include Bcc header in delivered email #773

Merged
merged 1 commit into from
Jun 9, 2023
Merged

Do not include Bcc header in delivered email #773

merged 1 commit into from
Jun 9, 2023

Conversation

adamu
Copy link
Contributor

@adamu adamu commented Jun 9, 2023

Proposal following this discussion.

According to RFC 5322 method 1:

when a message containing a "Bcc:" field is prepared to be sent, the "Bcc:" line is removed even though all of the recipients (including those specified in the "Bcc:" field) are sent a copy of the message

This PR removes the BCC header from the message that is delivered.

Note that the BCC addresses are still included in the recipients, so they will still receive the email. It is only the body that does not contain the bcc addresses:

recipients = all_recipients(email)
body = Helpers.body(email, config)
case :gen_smtp_client.send_blocking(
{sender, recipients, body},

@princemaple princemaple added the bug label Jun 9, 2023
@princemaple princemaple merged commit 7c9c0fe into swoosh:main Jun 9, 2023
11 checks passed
@princemaple
Copy link
Member

💜

@adamu
Copy link
Contributor Author

adamu commented Jun 9, 2023

Digging some more, it looks like this was deliberately added in #105. There might be multiple use-cases? At least the comment I left explains why it's not there now.

@princemaple
Copy link
Member

That didn't make sense :) I bet they just thought it was not sending correctly.

@thiamsantos
Copy link
Contributor

thiamsantos commented Jun 19, 2023

@princemaple Hello, this change broke our implementation after the update, we had to rollback to v1.11.0.

We use the adapter Swoosh.Adapters.AmazonSES, one of our emails do not have any to but only the bcc fields. I imagine that as the adapter uses the smtp helper to build a email and send via http to aws, SES stopped receiving the bcc and cannot build the receipients.

We started receiving from aws the following error:

{:error, %{code: "InvalidParameterValue", message: "Missing required header 'To'."}}

@adamu
Copy link
Contributor Author

adamu commented Jun 19, 2023

It looks like this could be the case for the Sendmail adapter too. I guess they should not be using the SMTP Adapter's internal helper code.

@princemaple
Copy link
Member

@thiamsantos looks like we have to distinguish between adapters that use SMTP format and real SMTP on handling of BCC. Thanks for reporting. Will fix soon.

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

Successfully merging this pull request may close these issues.

None yet

3 participants