Author |
|
meyerovb Newbie
Joined: 12 September 2008
Online Status: Offline Posts: 10
|
Posted: 07 December 2008 at 2:14pm | IP Logged
|
|
|
I have a text editor that sometimes returns the char code of 160 instead of 32 to represent spaces. When I insert this into the html body of the MailBee objects, it creates an invalid character in the saved message file. How do I get it to properly interpret the character?
string body = "test" + char.ConvertFromUtf32(160) + "test", from = "a@a.com", to = "b@b.com";
MailBee.Mime.MailMessage beeMessage = new MailBee.Mime.MailMessage();
beeMessage.From.AsString = from;
beeMessage.To.AsString = to;
beeMessage.BodyHtmlText = body;
beeMessage.SaveMessage("d:\\beeTest.eml");
creates the following message:
MIME-Version: 1.0
X-Mailer: MailBee.NET 4.0.2.105
From: a@a.com
To: b@b.com
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_7 F5B_1975F2F1.B7E1C608"
------=_NextPart_000_7F5B_1975F2F1.B7E1C608
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
test test
------=_NextPart_000_7F5B_1975F2F1.B7E1C608
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
test=A0test
------=_NextPart_000_7F5B_1975F2F1.B7E1C608--
System.Net.Mail.MailMessage netMessage = new System.Net.Mail.MailMessage(from, to);
netMessage.Body = body;
netMessage.IsBodyHtml = true;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory;
smtp.PickupDirectoryLocation = "d:\\";
smtp.Send(netMessage);
creates the following message:
X-Sender: a@a.com
X-Receiver: b@b.com
MIME-Version: 1.0
From: a@a.com
To: b@b.com
Date: 7 Dec 2008 17:10:11 -0500
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
dGVzdMKgdGVzdA==
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 08 December 2008 at 7:43am | IP Logged
|
|
|
Actually, we don't see any problems there. You insert a char with code 160, and a char with code 160 is inserted in the message. If you don't want that char to be inserted, you should replace it with another character, e.g. with code 32.
Best regards,
Andrew
|
Back to Top |
|
|