Search code examples
mandrillsmtpclientbcc

.NET SmtpClient exposing 10 e-mail addresses when using BCC (via Mandrill)


I'm using the following code to send an email to a list of users:

public async Task BroadcastMessage(IEnumerable<User> users, string subject, string body)
{
    var email = new MailMessage { Subject = subject, Body = body, IsBodyHtml = true };

    users.ToList().ForEach(x => email.Bcc.Add(new MailAddress(x.Email, x.FullName)));

    email.Headers.Add("X-MC-Subaccount", "xxxxx");

    using (var client = new SmtpClient())
    {
        await client.SendMailAsync(email);
    }
}

The message is sent via Mandrill.

As the code shows, I'm adding the users to the BCC field. However, when the recipients receive the message they see 10 of their fellow subscribers (there are more than 10 in total). Clearly, I don't want to expose others' email addresses.

I'm confused as to why, when I'm adding them to BCC, they are being shown. Does anyone know what is happening? I'm not sure if this is an SmtpClient issue or a Mandrill issue.


Solution

  • In your Mandrill Settings -> Sending Defaults there's a setting to disable that.

    Make sure this isn't set: https://i.sstatic.net/8vK4U.jpg