xpepermint / smtp-client

Simple, promisified, protocol-based SMTP client for Node.js.
36 stars 13 forks source link

dot stuffing missing when sending data #9

Closed t3r closed 3 years ago

t3r commented 3 years ago

Sending messages that contain a single dot on a line leads to incomplete message for the recipient. The reason for that is that a single dot is interpreted as "end of mail" on the mail server. According to https://tools.ietf.org/html/rfc5321#section-4.5.2, each dot at the beginning of a line needs to be doubled.

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.

Hacky solution: do

    source = source.replace(/^\./m,'..');

just before line 295 of index.js

t3r commented 3 years ago

Pullrequest #10 is active. FWIW, this is message body fails without the patch:

    hello
    .
    world

Only the word "hello" will arrive at the recipients inbox and the word "world" will be rejected by the SMTP Server as an invalid command.