cURL / Mailing Lists / curl-library / Single Mail

curl-library

Dot character as first character in smtp email

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Tue, 15 May 2012 15:19:39 +0100

Hi Guys,

I noticed a small bug in the smtp module over the last 24 hours, which I'm
surprised I've not spotted before!

It seems that if a line starts with a full stop / period / dot character
then the character is stripped away by the server (Microsoft Exchange in
this instance).

The EOB checking function looks for CRLF.CRLF and replaces it with CRLF..
before checking for the next instance of CRLF.CRLF beginning with the last
two characters of the previous match.

The following is an extract from Section 4.5.2 of RFC2821:

Before sending a line of mail text, the SMTP client checks the
first character of the line. If it is a period, one additional
period is inserted at the beginning of the line.

Interesting the next paragraph goes on to say:

When a line of mail text is received by the SMTP server, it checks
the line. If the line is composed of a single period, it is
treated as the end of mail indicator. If the first character is a
period and there are other characters on the line, the first
character is deleted.

I have prepared a fix but just quickly wanted to ask if there is a specific
reason we are checking for CRLF.CRLF before I push the fix. I appreciate
I've done a fair bit of work in this area but I can't think why it is being
done like this and not as per the RFC.

Interestingly it seems that pop3 is doing the correct thing when a line
starts with .. replacing the two characters with one - which I believe we
fixed up towards the end of last year ;-)

Kind Regards

Steve

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-15