FIX: Email client does not support a name in a delivery address field that is encoded by the MailMessage class in the .NET Framework 4 if the name contains a non-ASCII character

Symptoms

Consider the following scenario:
  • A Microsoft .NET Framework 4-based application uses the System.Net.Mail.MailMessage class to send an email message. 
  • A name in a delivery address field of the email message contains a non-ASCII character and a delimiter character.

    For example, the name contains a registered trademark symbol (®) character and a comma, semicolon, or colon character.

    Note The delivery address fields are the From, To, Cc, and Bcc fields.
In this scenario, the name is encoded by using a format that is not supported by some email clients.  

For example, Microsoft Outlook 2007 and Mozilla Thunderbird display the name incorrectly because they do not support the encoded format. 

Note This issue does not affect Microsoft Outlook 2010.

Cause

This issue occurs because the System.Net.Mail.MailMessage class does not encode the delimiter character.

Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To download this hotfix from the MSDN Code Gallery, visit the following Microsoft Web site:

http://archive.msdn.microsoft.com/KB2576045

Note The MSDN Code Gallery displays the languages for which the hotfix is available. If you do not see your language listed, it is because the Code Gallery resource page is not available for that language.

Note Alternatively, you can download this hotfix rollup from the following Microsoft Connect Web site: http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=39149

Prerequisites

To apply this hotfix, you must have the .NET Framework 4 installed.

Restart requirement

You must restart the computer after you install this hotfix if the affected files are being used.

We recommend that you exit all .NET Framework applications before you install this hotfix.

File information

The global version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, and of Windows 7
File nameFile versionFile sizeDateTimePlatform
System.dll4.0.30319.4993,511,11210-Aug- 201106:51x86
For all supported x64-based versions of Windows XP, of Windows Server 2003, of Windows Vista, of Windows Server 2008, of Windows 7, and of Windows Server 2008 R2
File nameFile versionFile sizeDateTimePlatform
System.dll4.0.30319.4993,511,11210-Aug- 201106:51x64
For all supported IA-64–version of Windows Server 2003, of Windows Server 2008, and of Windows Server 2008
File nameFile versionFile sizeDateTimePlatform
System.dll4.0.30319.4993,511,11210-Aug-201106:51IA-64


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

This issue occurs when you use code that resembles the following:
System.Net.Mail.MailMessage myMailMessage = new System.Net.Mail.MailMessage(); myMailMessage.To.Add(new System.Net.Mail.MailAddress("toUser@someDomain.com", "\"To, User, Contoso®\"")); myMailMessage.From = new System.Net.Mail.MailAddress("fromUser@someDomain.com", "\"From, User, Contoso®\"");
The encoding for the From and To fields that are in this code resembles the following:
X-Sender: =?utf-8?Q?From,_User,_Contoso=C2=AE?= <fromUser@someDomain.com> X-Receiver: =?utf-8?Q?To,_User,_=Contoso=C2=AE?= <toUser@someDomain.com> MIME-Version: 1.0 From: =?utf-8?Q?From,_User,_Contoso=C2=AE?= <fromUser@someDomain.com> To: =?utf-8?Q?To,_User,_Contoso=C2=AE?= <toUser@someDomain.com>
For example, Office Outlook 2007 and Mozilla Thunderbird display the following incorrect values for the From and To fields:
From: =?utf-8?Q?From, _User, _=Contoso=C2=AE?= <fromUser@someDomain.com>
To: : =?utf-8?Q?To, _User, _=Contoso=C2=AE?= <toUser@someDomain.com>

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, about the performance or reliability of these products.
Vlastnosti

ID článku: 2576045 – Posledná kontrola: 13. 10. 2011 – Revízia: 1

Pripomienky