https://bugzilla.novell.com/show_bug.cgi?id=346162
Summary: Sys.Net.Mail: Encoding problems when using
AlternateViews
Product: Mono: Class Libraries
Version: SVN
Platform: i686
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: System
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
QAContact: [EMAIL PROTECTED]
Found By: ---
When sending MailMessages containing AlternateViews, the encoding is messed up
(and the charset is never stated in the mail). I've tested this with the very
latest code from SVN (r90741).
(Also note that MS.NET replaces an empty Subject with "No subject".)
Test case:
==========
using System;
using System.Text;
using System.Net.Mail;
class Test {
static void Main(string[] args) {
MailMessage msg = new MailMessage(args[1], args[2]);
msg.Body =
"<html><body>Test: H\u00e4ll\u00f6!" +
"</body></html>";
msg.IsBodyHtml = true;
msg.BodyEncoding = Encoding.GetEncoding("ISO-8859-1");
msg.AlternateViews.Add(
AlternateView.CreateAlternateViewFromString(
"Test: H\u00e4ll\u00f6!",
Encoding.GetEncoding("ISO-8859-1"),
"text/plain"
)
);
SmtpClient smtp = new SmtpClient(args[0]);
smtp.Send(msg);
Console.WriteLine(msg.Body);
}
}
Usage:
======
mono MailTest.exe [smtp hostname] [from] [to]
Result Mono:
============
Date: Wed, 05 Dec 2007 12:56:10 +01:00
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary=--boundary_0_537bb184-5012-4b33-b13b-38f3265d72b5
Message-Id: <[EMAIL PROTECTED]>
X-Evolution-Source: imap://[EMAIL PROTECTED]/
--
content-type: multipart/alternative;
boundary=--boundary_0_537bb184-5012-4b33-b13b-38f3265d72b5
----boundary_0_537bb184-5012-4b33-b13b-38f3265d72b5
content-type: text/html
content-transfer-encoding: quoted-printable
<html><body>Test: H?ll?!</body></html>
----boundary_0_537bb184-5012-4b33-b13b-38f3265d72b5
content-type: text/plain
content-transfer-encoding: quoted-printable
Test: H?ll?!
----boundary_0_537bb184-5012-4b33-b13b-38f3265d72b5--
Result .NET
===========
mime-version: 1.0
from: [EMAIL PROTECTED]
to: [EMAIL PROTECTED]
date: 5 Dec 2007 12:59:22 +0100
content-type: multipart/mixed;
boundary=--boundary_0_bebbe2e1-1dea-4743-ac23-5570e728cc87
Message-Id: <[EMAIL PROTECTED]>
X-Evolution-Source: imap://[EMAIL PROTECTED]/
Subject: No Subject
----boundary_0_bebbe2e1-1dea-4743-ac23-5570e728cc87
content-type: multipart/alternative;
boundary=--boundary_1_95731698-9abb-48db-a8ad-8ae18935dac9
----boundary_1_95731698-9abb-48db-a8ad-8ae18935dac9
content-type: text/plain; charset=iso-8859-1
content-transfer-encoding: quoted-printable
<html><body>Test: H=E4ll=F6!</body></html>
----boundary_1_95731698-9abb-48db-a8ad-8ae18935dac9
content-type: text/plain; charset=iso-8859-1
content-transfer-encoding: quoted-printable
Test: H=E4ll=F6!
----boundary_1_95731698-9abb-48db-a8ad-8ae18935dac9--
----boundary_0_bebbe2e1-1dea-4743-ac23-5570e728cc87--
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs