+1 vote

Is it possible to remove the empty Bcc header that shows up in the email source when an email is sent with a Bcc address through the MailBuilder?

closed with the note: question answered from support
by
closed

1 Answer

0 votes
 
Best answer

There is AddressHeaderRenderMode enum with following values: NoHeader, EmptyHeader, Full.

By default AddressHeaderRenderMode.EmptyHeader is used, except for Yahoo servers (since version 3.0.22105.1207) where no BCC is used.

You can set it on Smtp client's SmtpConfiguration:

using(Smtp client = new Smtp())
{
    client.Configuration.BccRenderMode = 
        AddressHeaderRenderMode.NoHeader;

    ...

    client.SendMessage(email)
}

When rendering you can use IMail.Render(AddressHeaderRenderMode bccRenderMode) overload:

MailBuilder builder = ...;
IMail email = builder.Create();

var eml = email.Render(AddressHeaderRenderMode.NoHeader);

Or use MailRenderConfiguration when creating SmtpMail:

Smtp client = ....

SmtpMail smtpMail = SmtpMail.CreateFrom(
    email, 
    new MailRenderConfiguration 
    { 
        BccRenderMode = AddressHeaderRenderMode.NoHeader
    });

client.SendMessage(smtpMail)
by (301k points)
...