Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Hex conversion of characters for smtp Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
meyerovb
Newbie
Newbie


Joined: 12 September 2008
Online Status: Offline
Posts: 10
Posted: 17 March 2009 at 11:35am | IP Logged Quote meyerovb

Place test<br>.<br>test into the html body of a message. Send it, and the smtp server receives:

Content-Type: multipart/alternative;
     boundary="----=_NextPart_000_9 B62_2D607113.638A5A1B"


------=_NextPart_000_9B62_2D607113.638A5A1B
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

test
..
test
------=_NextPart_000_9B62_2D607113.638A5A1B
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

test<br />.<br />test
------=_NextPart_000_9B62_2D607113.638A5A1B--

.


Save it to a file using SubmitToFolder, and the file receives:

Content-Type: multipart/alternative;
     boundary="----=_NextPart_000_9 B62_2D607113.638A5A1B"


------=_NextPart_000_9B62_2D607113.638A5A1B
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

test
.
test
------=_NextPart_000_9B62_2D607113.638A5A1B
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

test<br />.<br />test
------=_NextPart_000_9B62_2D607113.638A5A1B--



I am saving it off to be sent by a 3rd party mail queuing software that expects a well formed smtp message, and the . on it's own in the plain text section of the file is causing the message to become corrupted. How do I write out the properly formatted smtp message that you transmit to the smtp server out to a file?
Back to Top View meyerovb's Profile Search for other posts by meyerovb
 
meyerovb
Newbie
Newbie


Joined: 12 September 2008
Online Status: Offline
Posts: 10
Posted: 17 March 2009 at 11:37am | IP Logged Quote meyerovb

Title of the post is hex conversion because the other software i use converts the . into =2E when saving it to a file.
Back to Top View meyerovb's Profile Search for other posts by meyerovb
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 17 March 2009 at 11:43pm | IP Logged Quote Andrew

Quote:
Title of the post is hex conversion because the other software i use converts the . into =2E when saving it to a file.


That's Quoted-printable encoding. You can manage this by setting any of supported encodings in MailMessage.MailTransferEncodingPlain and MailMessage.MailTransferEncodingHtml properties.

Quote:
I am saving it off to be sent by a 3rd party mail queuing software that expects a well formed smtp message, and the . on it's own in the plain text section of the file is causing the message to become corrupted. How do I write out the properly formatted smtp message that you transmit to the smtp server out to a file?


Actually, MailBee.NET Objects generate well-formed messages. That's a bug of the third-party queuing software that it doesn't double dot on transmitting messages over SMTP. Examples of .eml files saved by Outlook Express:

Code:

From: <test@localhost>
To: <test@localhost>
Subject: test
Date: Wed, 18 Mar 2009 09:37:08 +0300
MIME-Version: 1.0
Content-Type: text/plain;
        format=flowed;
        charset="Windows-1252";
        reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Unsent: 1
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180

.


Code:

From: <test@localhost>
To: <test@localhost>
Subject: test
Date: Wed, 18 Mar 2009 09:41:26 +0300
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_0009_01C9A7AD.B6756EE0"
X-Priority: 3
X-MSMail-Priority: Normal
X-Unsent: 1
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180

This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C9A7AD.B6756EE0
Content-Type: text/plain;
        charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

.
------=_NextPart_000_0009_01C9A7AD.B6756EE0
Content-Type: text/html;
        charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial  size=3D2>.</FONT></DIV></BODY></HTML >

------=_NextPart_000_0009_01C9A7AD.B6756EE0--


Doubling must be performed during SMTP transmission, not in the original message.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
meyerovb
Newbie
Newbie


Joined: 12 September 2008
Online Status: Offline
Posts: 10
Posted: 18 March 2009 at 9:50am | IP Logged Quote meyerovb

I tried the following code, and both files still contained a single, unencoded . in the plain text area:

message.MailTransferEncodingPlain = message.MailTransferEncodingHtml = MailTransferEncoding.QuotedPrintable;

message.SaveMessage("D:\\a.eml");

MailBee.SmtpMail.Smtp s = new MailBee.SmtpMail.Smtp();
s.Message = message;
s.SubmitToPickupFolder("d:\\");

How do I output a message as a file with the . characters encoded in QuotedPrintable encododing (. becomes =2E)?
Back to Top View meyerovb's Profile Search for other posts by meyerovb
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 19 March 2009 at 4:11am | IP Logged Quote Andrew

As we mentioned previously, dot at the beginning of line in message body must be doubled by SMTP client during transmitting the data to SMTP server. EML files never contain dots doubled.

As for QuotedPrintable, you shouldn't enable it explicitly, as it's default encoding for messages with non-latin chars. Also, in case of QuotedPrintable, dot doesn't become =2E. Here's an example of message created by third-party e-mail client (The Bat! 4.1.9):

Code:
Date: Thu, 19 Mar 2009 13:48:54 +0300
From: Test <test@localhost>
Reply-To: Test <test@localhost>
Organization: AfterLogic
X-Priority: 3 (Normal)
Message-ID: <139227154.20090319134854@afterlogic.com>
To: Test <test@localhost>
Subject: test
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Return-Path: <test@localhost>

test
=D1=82=D0=B5=D1=81=D1=82
.

=D1=82=D0=B5=D1=81=D1=82
=D1=82=D0=B5=D1=81=D1=82 =D1=82=D0=B5=D1=81=D1=82 .

.=D1=82=D0=B5=D1=81=D1=82.
........


Another example generated by Outlook Express 6:

Code:
From: <test@localhost>
To: <test@localhost>
Subject: test
Date: Thu, 19 Mar 2009 14:06:12 +0300
MIME-Version: 1.0
Content-Type: text/plain;
        charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Priority: 3
X-MSMail-Priority: Normal
X-Unsent: 1
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180

test
=D1=82=D0=B5=D1=81=D1=82
.
=D1=82=D0=B5=D1=81=D1=82 =D1=82=D0=B5=D1=81=D1=82.
.=D1=82=D0=B5=D1=81=D1=82.
.......

.
=D1=82=D0=B5=D1=81=D1=82


As you can see, popular mailers don't double or QP-encode dots in message sources.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 19 March 2009 at 4:13am | IP Logged Quote Andrew

If non-encoded dots cause issues when sending through the third-party queue, that's definitely a bug of that third-party queue. You may try MailBee Message Queue, it doesn't have such a bug.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
meyerovb
Newbie
Newbie


Joined: 12 September 2008
Online Status: Offline
Posts: 10
Posted: 19 March 2009 at 6:36am | IP Logged Quote meyerovb

I'd be happy to bring this to them, except they'll probably point out the following:

System.Net.Mail.SmtpClient s = new System.Net.Mail.SmtpClient();
s.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory;
s.PickupDirectoryLocation = "d:\\";
s.Send(new System.Net.Mail.MailMessage("a@a.com", "a@a.com", "subject", "."));

generates:

X-Sender: a@a.com
X-Receiver: a@a.com
MIME-Version: 1.0
From: a@a.com
To: a@a.com
Date: 19 Mar 2009 09:30:43 -0400
Subject: subject
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

..

It seems to be industry standard to double dot a file submitted to a queuing directory. Please address this issue in your code base, or provide me with a workaround to generate a valid smtp file from your mime message object (I only have a licence to IMAP, not SMTP).
Back to Top View meyerovb's Profile Search for other posts by meyerovb
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 19 March 2009 at 10:23am | IP Logged Quote Alex

No, it's a well-known and confirmed problem in Microsoft products. To address it, they added DisablePickupDotStuff key in IIS metabase which controls this behavior.

Periods at the beginning of a line are removed when placed into the SMTP Pickup directory

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide