I am successfully sending a mime message using libcurl. However, in the received email I can only see the "username" in the From: field.
curlCode_ = curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from_field);
recipients = curl_slist_append(recipients, (const char *)to_);
recipients = curl_slist_append(recipients, cc.str().c_str());
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
I assume its a security feature at gmail, ensuring that the sender is always shown in the From field. Another issues is that I send out a multi-part mime message with an alt text portion. In zoho mail, I can view the HTML, however gmail always shows the text part.
For reference, I make sure the HTML comes before the text.
/* Build the mime message. */
mime = curl_mime_init(curl);
/* The inline part is an alternative proposing the html and the text
versions of the e-mail. */
alt = curl_mime_init(curl);
/* HTML message. */
part = curl_mime_addpart(alt);
curl_mime_data(part, html_body_.c_str(), CURL_ZERO_TERMINATED);
curl_mime_type(part, "text/html");
/* Text message. */
part = curl_mime_addpart(alt);
curl_mime_data(part, body_.c_str(), CURL_ZERO_TERMINATED);
/* Create the inline part. */
part = curl_mime_addpart(mime);
curl_mime_subparts(part, alt);
curl_mime_type(part, "multipart/alternative");
slist = curl_slist_append(NULL, "Content-Disposition: inline");
curl_mime_headers(part, slist, 1);
The code is rather long and in multiple classes, so I can post any code deemed relevant to avoid clutter. Essentially I am unsure how to debug this.