karastojko/mailio

add_bcc_recipient

Mask-K opened this issue · 8 comments

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

Let me debug it.

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

  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

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?

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'?

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.

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?

Fixed with the PR.