Question : Basic SMTP protocol question

Hey everybody

I have a bit of a silly question regarding the SMTP protocol.

In the protocol, to start writing the data the client need to send: DATA[CRLF],
and in order to tell the server we're done, the client sends [CRLF].[CRLF].

BUT, what happens if the CONTENT of the email itself is [CRLF].[CRLF] ???

the client would have to send:
DATA[CRLF]
[CRLF]
.
[CRLF]
[CRLF]
.
[CRLF]

But the "dot" would be considered as "end of DATA".

So how do you overcome such a problem in the protocol?

Answer : Basic SMTP protocol question

In http://www.ietf.org/rfc/rfc0821.txt you have:

Without some provision for data transparency the character
         sequence "." ends the mail text and cannot be sent
         by the user.  In general, users are not aware of such
         "forbidden" sequences.  To allow all user composed text to be
         transmitted transparently the following procedures are used.

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

            2. When a line of mail text is received by the receiver-SMTP
            it checks the line.  If the line is composed of a single
            period it is the end of mail.  If the first character is a
            period and there are other characters on the line, the first
            character is deleted.
Random Solutions  
 
programming4us programming4us