emailsmtprfc

SMTP dot stuffing.. when and where to do it?


I have found conflicting information about dot stuffing when transmitting an email.

  1. stuff a dot if the line contains a single dot (to avoid premature termination)
  2. stuff a dot to every line that starts with a dot
  3. stuff a dot to (1) and to every line part of a quoted-printable message part

Can anyone clarify?


Solution

  • According to the SMTP standard RFC 5321, section 4.5.2:

    https://www.rfc-editor.org/rfc/rfc5321#section-4.5.2

    To 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.

    So, from the three points of your question, the second one is right.