muquit / mailsend

A program to send mail via SMTP from command line
Other
295 stars 68 forks source link

[S] 554 Rejected - Message containing bare LF's. #52

Open tmassimi opened 10 years ago

tmassimi commented 10 years ago

Hi, I'm using mailsend1.17b2 and had the error in the subject when seng emails via some mailserver (Hmailserver).

I have made a fix but unlikely the code on the trunk is changed too much, so I can't send a patch.

the main problem was in this code

            /* vinicio qmail fix */
            len=strlen(mbuf);
            if (mbuf[len-1] != '\n')
                strcat(mbuf,"\r\n");
            else
            {
               mbuf[--len]='\0';
               strcat(mbuf,"\r\n");
            }
            /* vinicio qmail fix */

if mbuf already ends with \r\n, the resulting buffer will end with "\r\r\n", from here the error message "contains bare LF's". I changed only the "else" with this one: "else if (mbuf[len-2] != '\r')"

the second problem was that when splittng an attachment in lines, the "vinicio qmail fix" was missing at all, so some illegal line was sent to the mail server (unlikely I can't find this part in the current code)