質問

We have an email job that uses System.Net.Mail

Emails get sent to a folder, and a job runs to copy the files to the Pickup folder on our Exchange server at a specified time of day. A copy of the email gets sent to an internal mailbox by using the Bcc field.

There is a known issue where the Bcc property doesn't get added to emails that get sent using Exchange's Pickup folder, so the workaround is to add the Bcc field directly to the message header, however this stopped working as of 7/28/2012.

' BCC doesn't work when sent internally using the Pickup folder, 
' so need to add to message headers instead
'message.Bcc.Add(New MailAddress("internalMailbox@mydomain.com"))
message.Headers.Add("Bcc", "internalMailbox@mydomain.com")

Dim smtp = New SmtpClient(exchangeServer)
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory
smtp.PickupDirectoryLocation = temporaryEmailFolder

smtp.Send(message)

Did Microsoft change something in Exchange so Bcc addresses in the email headers no longer work either? Or is there another way around this?

I tried switching to System.Web.Mail, but I am unable to get the messages to deliver to a folder.

We're using Exchange 2010 on a Windows Server 2008 R2 Standard machine

Edit:

There were a whole bunch of updates installed on that date. I'm guessing one of them is causing this problem, but there's a huge list of them and its slow going. Anyone know of any known issues related to Bcc message headers not getting processed with the following updates?

  • Exchange Server 2010 Update Rollup 6 (KB2529939)
  • Exchange Server 2010 Update Rollup 3-v3 (KB2608646)
  • a Microsoft Office 2010 Filter Pack Service Pack 1 (SP1)
  • a Silverlight update
  • and 52 Security updates, Hot Fixes, and Updates for Windows
    • Hotfix KB2679255
    • Security Update KB2536276
    • Security Update KB2560656
    • Security Update KB2564958
    • Security Update KB2567680
    • Security Update KB2570947
    • Security Update KB2584146
    • Security Update KB2585542
    • Security Update KB2604115
    • Security Update KB2620704
    • Security Update KB2520712
    • Security Update KB2521440
    • Security Update KB2631813
    • Security Update KB2643719
    • Security Update KB2644615
    • Security Update KB2645640
    • Security Update KB2653956
    • Security Update KB2654428
    • Security Update KB2655992
    • Security Update KB2656356
    • Security Update KB2656373
    • Security Update KB2656411
    • Security Update KB2658846
    • Security Update KB2659262
    • Security Update KB2667402
    • Security Update KB2676562
    • Security Update KB2685939
    • Security Update KB2686831
    • Security Update KB2688338
    • Security Update KB2690533
    • Security Update KB2691442
    • Security Update KB2695962
    • Security Update KB2698365
    • Security Update KB2699988
    • Security Update KB2709715
    • Security Update KB2718523
    • Security Update KB2719985
    • Update KB2545698
    • Update KB2547666
    • Update KB2552343
    • Update KB2563227
    • Update KB2603229
    • Update KB2507047
    • Update KB2608658
    • Update KB2633952
    • Update KB2640148
    • Update KB2660075
    • Update KB2677070
    • Update KB2699779
    • Update KB2709630
    • Update KB2718704
    • Windows IE 9

Or does anyone know of an easier way to check out what updates do, and if these ones are causing this particular problem?

役に立ちましたか?

解決

I can't figure out which update is causing this problem, and don't have the time to uninstall them one at a time to figure it out, so found an alternative.

I noticed that the header information is no longer getting added at all in the emails using my current code, but adding the address as a Bcc still creates a 2nd X-Receiver line in the message header (which Exchange ignores when you drop the message into the Pickup folder), so I wrote a script that simply loops through the emails in the delivery folder and replaces the 2nd X-Receiver line with a Bcc instead.

' This no longer adds Bcc to message header for whatever reason
'message.Headers.Add("Bcc", "bccRecipient@mydomain.com")
message.Bcc.Add(New MailAddress("bccRecipient@mydomain.com"))

...

Dim content As String
Dim regex As Regex = New Regex("(X-Receiver:.*?\n)(X-Receiver:)")

' Replace of the 2nd instance of "X-Receiver:" with "Bcc:"
For Each fileName As String In Directory.GetFiles(EMAIL_DELIVERY_FOLDER)
    content = File.ReadAllText(fileName)
    content = regex.Replace(content, "$1Bcc:", 1)
    File.WriteAllText(fileName, content)
Next

This changes the email header from

X-Sender: "Test"
 <sender@mydomain.com>
X-Receiver: receipient@mydomain.com
X-Receiver: bccRecipient@mydomain.com
MIME-Version: 1.0

to

X-Sender: "Test"
 <sender@mydomain.com>
X-Receiver: receipient@mydomain.com
Bcc: bccRecipient@mydomain.com
MIME-Version: 1.0

which correctly sends a blind copy of the email to the specified Bcc address when the .eml message is dropped into Exchange's Pickup folder

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top