cURL / Mailing Lists / curl-library / Single Mail


Re: SMTP, data corruption and dot stuffing

From: <>
Date: Wed, 19 Oct 2011 13:19:43 +0200

Hi Steve,

> I tend to send the following information in my message header:
> Content-Type: multipart/mixed; boundary="pj+EhsWuSQJxx7pr"
> Mime-version: 1.0
> Note: The boundary is generated for each message (and sub messages if I am
> including plain text and html data as well) and then I send the following in
> my message body:
> --pj+EhsWuSQJxx7pr
> Content-Type: application/octet-stream; name="filename.ext"
> Content-Transfer-Encoding: base64
> Content-Description: filename.ext
> Content-Disposition: attachment; filename="filename.ext"; size=xxxxx
> base64 data removed for clarity
> --pj+EhsWuSQJxx7pr--

A typical message will look like this :

Date: Mon, 17 Oct 2011 22:03:21 +0200
From: ...
MIME-Version: 1.0
To: ...
Subject: =?UTF-8?B?dGVzdA==?=
Content-Type: multipart/mixed;

This is a multi-part message in MIME format.
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

test att.

Content-Type: application/pdf;
Content-Transfer-Encoding: base64
Content-Disposition: attachment;


> You mentioned the issue was hard to reproduce but do you see the dot every
> 16384 bytes when you do see the problem or is it a one off?

You'll see in the thread that I've just posted a small test program
that will always reproduce the error. The error was hard to
reproduce in real life conditions cause you need <CR><LF> at the end
of the CURL_MAX_WRITE_SIZE and depending on your header, your body,
your attachment name etc... CURL_MAX_WRITE_SIZE could always end on
some random character.

> Are you able to debug you application and add a breakpoint in
> Curl_smtp_escape_eob() to see if it is this function has an issue. I would
> suggest putting the break point in the if block near the end of the function
> that starts if(si != nread).

Right now I'm using libcurl as a shared library (dll) in MSVC10
(Windows), so I can't/don't know how to do this.
I'll have to build my test with the relevant libcurl .c files to put
a breakpoint in source file (that I can do). I'll see if I can
manage to do this (I don't know if the libcurl make files for
windows are doing some special preprocessing that'll prevent this).

> How are you passing your data to libcurl (eg. As a FILE* or via
> CURLOPT_READFUNCTION) and what version of libcurl are you using?

Latest version of libcurl 7.22, Windows 7, Visual C++ Express 2010.
I'm using a CURLOPT_READFUNCTION, I'll try to pass FILE* to see if
it changes something.

Thanks for your answer.

List admin:
Received on 2011-10-19