Skip to content

Add support for BCC #8

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

delbertooo
Copy link

As mailhog is primarily a debugging tool we want to validate the correctness of bcc and cc as well.

See #98, #261

Possible solutions

  • multiply the emails for each recipient
  • show cc and bcc addresses in the preview

Duplicating emails won't help debugging and may make it even worse. So we went for the "show in preview" option.

Implementation

Bcc should not be contained in the mail source. Otherwise it wouldn't be a "blind" copy as the recipients could see the blind copy recipients. Every recipient (to, cc, bcc) should be part of the RCPT though. So from my understanding and the insight of this Mailtrap article bcc should be allRecipients - to - cc. This calculated bcc is what I implemented and added to the Message struct.

On the GUI side I decided to follow the suggestion of
jankonas
and show cc and bcc alongside with "from" and "subject". Cc and bcc are only shown if they have content. This way the user can easily debug who should've received the mail.

@delbertooo
Copy link
Author

I built a docker image as a preview with the cc/bcc support added by this pull requests. You can find it at delbertooo/mailhog-bcc.

@msde
Copy link

msde commented Oct 6, 2021

I needed exactly this yesterday, and the supplied docker image worked as expected.

@w455im
Copy link

w455im commented Oct 24, 2022

Hello, can this be merged please ? it is very much needed 😞

@JoeFowlerJDi
Copy link

Another +1 for merging this, or else doing something else like it.

The current behaviour of ignoring bcc can very easily be mistaken for a bug on the mail sender's side. I had to do a little digging to realise that we were setting the bcc correctly, it just doesn't show up in mailhog.

@konigprinz
Copy link

Please merge this. As a developer, this is a very useful feature.

Copy link

@FrancoMaxime FrancoMaxime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: code and functional review

@FrancoMaxime
Copy link

Hello,
Great job for the PR.

What do you think about adding these information into the Show Headers panel?

Capture d’écran du 2025-02-21 11-30-28
Capture d’écran du 2025-02-21 11-30-14

Regards,

Maxime

@delbertooo
Copy link
Author

Hi, the TO and CC parts are shown in the headers. IMO the BCC should not be shown in the headers unless the sending server explicitly sent it as a header. Here is why:

If the sending server is sending BCC as a header that is technically wrong or at least unusual. It's wrong(ish) because the receiver could simply inspect the mail source (e.g. in Gmail or Thunderbird) and see which people were receiving BCC. This invalidates the whole purpose of BCC.
Mailhog is - at least for me - a tool for debugging and mocking E-Mail communication. From the debugging perspective I want to know (among other things),

  • if BCC is working correctly and
  • what exact headers the sending server has sent.

From this debugging perspective, I would rather not like to see a somehow modified version of the source parts of the original email. But I'm open to further discussions on this point.

@FrancoMaxime
Copy link

@delbertooo Thanks a lot for the explanation. I agree with you

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

Successfully merging this pull request may close these issues.

7 participants