karastojko / mailio

mailio is a cross platform C++ library for MIME format and SMTP, POP3, IMAP protocols. It is based on the standard C++ 17 and Boost library.
Other
381 stars 102 forks source link

Allow formatting of BCC addresses #150

Closed LhKipp closed 8 months ago

LhKipp commented 10 months ago

Hi karastojko,

thanks for the library. I've seen commit 1124e1e removes formatting of the bcc addresses.

I believe the commit has been added, because when one email-server sends the email to another, the bcc address should be excluded.

However we at PPRO are sending the email - formatted as a mime message - from our application to AWS-SES. AWS-SES will parse the mime message and retrieve the destinations from the to,cc,bcc headers. AWS SES will omit the bcc addresses on sending them to the destination mail servers.

For our use case it would be beneficial to format the bcc address. Would you be okay, with me opening a PR to make adding the BCC address to the formatted message configurable? E.G.:

msg.format(buffer, true /*dot_escape*/, true /*add_bcc_header*/)

or

mailio::message::format_options opts {.dot_escape = true /*default false*/, .add_bcc_header = true /*default false*/};
msg.format(buffer, opts);

Thanks for your time and effort 👍🏻

karastojko commented 10 months ago

Hi Leonhard, Thanks for the explanation. Sure, let's make a PR and discuss it. I was also looking into the SMTP specification for these headers. The bug looked to me critical, so this was the fastest fix. Probably it could be improved.

Thanks

karastojko commented 8 months ago

PR merged. Thanks a lot!