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

add_bcc_recipient #146

Closed Mask-K closed 11 months ago

Mask-K commented 11 months ago

so I'm trying to send a message to several users like this:

msg->add_bcc_recipient(mailio::mail_address("Customer", recipient1)); msg->add_bcc_recipient(mailio::mail_address("Customer", recipient2));

but the problem is that recipients can see each others email addresses. Checked on gmail and outlook

karastojko commented 11 months ago

Let me debug it.

karastojko commented 11 months ago

I am not able to reproduce it. Can you please give me the full example with the mangled sensitive data?

Mask-K commented 11 months ago
  auto msg = std::make_shared<mailio::message>();
  msg->header_codec(mailio::message::header_codec_t::BASE64);
  msg->from(mailio::mail_address("My name", m_config->smtp->email));
  msg->content_transfer_encoding(mailio::mime::content_transfer_encoding_t::QUOTED_PRINTABLE);
  msg->content_type(mailio::message::media_type_t::TEXT, "html", "utf-8");
  msg->add_bcc_recipient(mailio::mail_address("Customer", "mail1@gmail.com"));
  msg->add_bcc_recipient(mailio::mail_address("Customer", "mail2@gmail.com"));
  msg->add_bcc_recipient(mailio::mail_address("Customer", "mail3@gmail.com"));

  msg->subject("New goods in the store!");
  msg->content("");
  m_connection->submit(*msg);

image

karastojko commented 11 months ago

Thanks @Mask-K for the example, I was able to reproduce it.

Can you please try the quick fix and let me know does it work for you?

Mask-K commented 11 months ago

image Yep, that works! But is there a way for each user to see his email in field to whom and not see other users'?

karastojko commented 11 months ago

I think mailio could be changed in that way, but I believe it would be against the specification. I will check for that, also I am not sure whether the undisclosed-recipients is specified.

karastojko commented 11 months ago

The RFC 5322/3.6.3 allows that the Bcc users see their own addresses in the Bcc field (others are hidden of course). The To and Cc recipients remain where they are. Is it acceptable to you?

karastojko commented 11 months ago

Fixed with the PR.