<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[libcurl corrupted attached file]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">When I attached simple jpeg file, the mail received has corrupted one like below, same for xlsx file, it can not be open due corrupted.</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/486d95c6-ee5b-4f20-a72b-64efa3f316a8.jpeg" alt="test.jpeg" class=" img-fluid img-markdown" /> url de l'image)</p>
<pre><code>part = curl_mime_addpart(alt);
curl_mime_data(part, msg.toStdString().c_str(), CURL_ZERO_TERMINATED);
curl_mime_type(part, "text/html; charset=utf-8 ");

/* Create the inline part. */
part = curl_mime_addpart(mime);
curl_mime_subparts(part, alt);
curl_mime_type(part, "multipart/alternative");
slist = curl_slist_append(nullptr, "Content-Disposition: inline");
curl_mime_headers(part, slist, 1);

/* Add the current source program as an embbeded image. */
part = curl_mime_addpart(mime);
QString logo=QApplication::applicationDirPath()+"/Images/logo.jpeg";
curl_mime_filedata(part, logo.toStdString().c_str());

// Add the current source program as an attachment.
part = curl_mime_addpart(mime);
curl_mime_filedata(part, quotefile.toStdString().c_str());

// Add the current source program as an attachment.
/*part = curl_mime_addpart(mime);
for(int i=0;i&lt;fileList.count();i++)
{
    QString filename="./"+fileList[i];
    if(fileList[i]!="")
        curl_mime_filedata(part, filename.toStdString().c_str());
}*/
curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);

/* Send the message */
res = curl_easy_perform(curl);
</code></pre>
<p dir="auto">libcurl version 7.85<br />
operating system Qt 5.15.2 / Windows 10 / VS 2019</p>
<p dir="auto">Any body can help me?</p>
<p dir="auto">Best regards</p>
<p dir="auto">Philippe</p>
]]></description><link>https://forum.qt.io/topic/139431/libcurl-corrupted-attached-file</link><generator>RSS for Node</generator><lastBuildDate>Sat, 31 Oct 2026 12:55:03 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139431.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Sep 2022 16:55:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to libcurl corrupted attached file on Tue, 20 Sep 2022 07:44:45 GMT]]></title><description><![CDATA[<p dir="auto">I solved the issue with dfandrich suggestion, ising curl_mime_encoder:</p>
<p dir="auto">part = curl_mime_addpart(mime);<br />
QString logo=QApplication::applicationDirPath()+"/Images/logoIgn.jpeg";<br />
curl_mime_filedata(part, logo.toStdString().c_str());<br />
<strong>curl_mime_encoder(part, "base64");</strong></p>
]]></description><link>https://forum.qt.io/post/729409</link><guid isPermaLink="true">https://forum.qt.io/post/729409</guid><dc:creator><![CDATA[filipdns]]></dc:creator><pubDate>Tue, 20 Sep 2022 07:44:45 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl corrupted attached file on Tue, 20 Sep 2022 05:11:54 GMT]]></title><description><![CDATA[<p dir="auto">You are not setting a MIME type on the parts containing the JPEG image or the data from "quotefile".  This may result in something the receiver has to assume (incorrectly).</p>
]]></description><link>https://forum.qt.io/post/729381</link><guid isPermaLink="true">https://forum.qt.io/post/729381</guid><dc:creator><![CDATA[ChrisW67]]></dc:creator><pubDate>Tue, 20 Sep 2022 05:11:54 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl corrupted attached file on Mon, 19 Sep 2022 18:13:24 GMT]]></title><description><![CDATA[<p dir="auto">Seems like this is primarily a curl issue; have you tried asking on the curl forum/list?</p>
]]></description><link>https://forum.qt.io/post/729337</link><guid isPermaLink="true">https://forum.qt.io/post/729337</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Mon, 19 Sep 2022 18:13:24 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl corrupted attached file on Mon, 19 Sep 2022 18:13:11 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Since everything looks like done through curl, I would rather debug that part. The only Qt code here is the retrieval of the image path.</p>
<p dir="auto">You should reduce your code to the minimal that allows you to achieve what you want and then add the rest.</p>
]]></description><link>https://forum.qt.io/post/729336</link><guid isPermaLink="true">https://forum.qt.io/post/729336</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 19 Sep 2022 18:13:11 GMT</pubDate></item></channel></rss>