问题
I have written an email client and have from time to time noticed that links in some received mails fail because of two dots in a URL where there should be one.
By Investigating, I found that in all such cases the two dots are at the start of a line of quoted-printable HTML.
On reading RFC 2821, I see this is probably happening because of dot-stuffing. My question basically is, who should do the dot-stuffing and who should remove it?
If we take a simple sequence we have as follows:
A ----> B ----> C ----> D
where A is the sending client, B is the SMTP server to which A sends the mail, C is the recipient's SMTP server, and D is the receiving client.
RFC 2821 appears to say that A should add an extra dot if a line starts with a dot, and B should remove it (which makes sense to me). However, what I observe in practice is that B adds a dot if A forgets to, but otherwise does nothing. Mails arriving at D have not had the extra dot removed. Have I misunderstood the RFC and is it therefore D's job to remove the extra dot?
回答1:
Please refer to the SMTP standard RFC2821 section 4.5.2:
http://tools.ietf.org/html/rfc2821#section-4.5.2
allow all user composed text to be transmitted transparently, the following procedures are used:
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.
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.
来源:https://stackoverflow.com/questions/8971703/smtp-dot-stuffing-who-does-it-and-who-removes-it