R – BCC never sent from Exchange 2007 using SpecifiedPickupDirectory

.netemailexchange-serversmtpclient

I'm using an Exchange 2007 pickup directory to send emails from my ASP.NET application with System.Net.Mail.SmtpClient. Thus I'm using SmtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory. It sends emails fine, but then I noticed that BCC is not working at all. The file being placed in the pickup folder seems to have the right settings, but Exchange is ignoring the X-Receiver list. Here is a sample of the EML file being created:

X-Sender: "Joe" <joe@example.com>
X-Receiver: david@example.com
X-Receiver: contact@example.com
X-Receiver: lindsey@example.com
MIME-Version: 1.0
From: "Joe" <joe@example.com>
To: david@example.com
Date: 10 Mar 2009 9:32:27 -0500
Subject: Test Message
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

<p>Test Message</p>

contact@ and lindsey@ are the BCC recipients. When I use a network send, it works fine. BCC only stops working with the pickup directory. So you know, I'm using Windows Server 2008 and ASP.NET 3.5 / C#.

Workaround

It seems that Exchange 2007 ignores the X-Receiver and expects to see Bcc: instead. So I've resorted to doing mailMessage.Headers.Add("Bcc", bccList) where bccList is a semicolon-delimited list of the email addresses. That works fine.

But as pointed Chase Seibert out if you look at the header of the message in the email client, you can still see all the X-Receivers listed. Though Bcc is stripped out and thus hidden from the recipients. So you get the effect of a Bcc with the possibility that someone will open the message and see all the Bcc's. I think the best way to suppress the X-Receivers list is to not include anything in the mailMessage.Bcc property.

Best Solution

This definitely works in Windows 2003 Server w/ just the MS SMTP implementation that ships with the OS. My understanding is that Exchange uses the same service to do it's sending.

Though this may not answer your question, I wanted to note that the Pickup method has a drawback that you might not be aware of. Typically, MS SMTP strips BCC and X-Recipient headers from the EML during the inbound transport.

When you put the EML into Pickup, you skip this step. Thus, remote recipients will actually be able to SEE the BCC recipients if they look at the email header. Try sending an email to a gmail account and BCC someone else. If you view the header in Gmail, you will see the BCC recipient.

I would recommend using SMTP to hand-off this message instead.

Related Question