cURL / Mailing Lists / curl-library / Single Mail


Bug in libcurl for rev 7.40.0

From: Tom Martin <>
Date: Sat, 21 Feb 2015 17:58:05 -0500

I found a bug in libcurl, one that can be demonstrated with the docs/examples/smtp-tls.c code.

Here are the details:

The issue I found in sending smtp tls email is this:
When any line of the outgoing email (especially the body text) contains a period at the end, it gets sent
with the period being the first character of the _following_ line. Not the line it's supposed to be on.

I made a few changes to docs/examples/smtp-tls.c to add my email server, TO & FROM
addresses and password, and changed the smtp:// to smtps://, and
send myself an email. This is on a Linux x86_64 box running Centos.

Example code from smtp-tls.c in docs/examples:
Notice how the '...body of the message..." has a period after 'here'.

static const char *payload_text[] = {
   "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
   "To: " TO "\r\n",
   "From: " FROM "(Example User)\r\n",
// "Cc: " CC "(Another example User)\r\n",
// "Message-ID: <>\r\n",
   "Subject: SMTP TLS example message\r\n",
   "\r\n", /* empty line to divide headers from body, see RFC5322 */
   "The body of the message starts here.\r\n",
   "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
   "Check RFC5322.\r\n",

I compiled and ran it, and got the following received email:

'The body of the message starts here\r\n
It could be a lot of lines, could be MIME encoded, whatever\r\n
.Check RFC5322\r\n

Notice how the periods get moved to the following lines.

If I then replace the periods in question to ';' or '-', they stay on the lines
correctly, and don't move to the following lines.

Thank you for the help.

List admin:
Received on 2015-02-21