Note that there are some explanatory texts on larger screens.

plurals
  1. POSMTP mail using libcurl
    primarykey
    data
    text
    <p>I compiled the c example the ships with libcurl.<br> The source file is <code>smtp-tls.c</code><br> Tried to use it to send mail through gmail and this is the response that I got<br></p> <blockquote> <ul> <li>About to connect() to smtp.gmail.com port 465 (#0)</li> <li>Trying 74.125.115.109... * connected</li> <li><p>Server auth using Basic with user 'xxxxxxx@gmail.com'</p> <blockquote> <p>GET / HTTP/1.1 Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Host: smtp.gmail.com:465 Accept: <em>/</em></p> </blockquote></li> <li><p>Empty reply from server</p></li> <li>Connection #0 to host smtp.gmail.com left intact</li> <li>Server returned nothing (no headers, no data)</li> <li>Closing connection #0 <br></li> </ul> </blockquote> <p>What did I miss? I did not modify the code in any way except for the variable inputs. On this machine I am able to send and receive mail using Outlook 2003.<br> EDIT<br> Tried a different port. This is the result<br></p> <blockquote> <ul> <li>About to connect() to smtp.gmail.com port 587 (#0)</li> <li>Trying 74.125.93.109... * connected</li> <li>Server auth using Basic with user 'xxxxxxx@gmail.com' <blockquote> <p>GET / HTTP/1.1 Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Host: smtp.gmail.com:587 Accept: <em>/</em></li> </ul> <p>220 mx.google.com ESMTP ew54y2x5of95qdz.12 502 5.5.1 Unrecognized command. ew54y2x5of95qdz.12 * Connection #0 to host smtp.gmail.com left intact * Closing connection #0<br></p> </blockquote></p> </blockquote> <p><strong>EDIT</strong><br> Main looks like this<br></p> <pre><code>int main() { CURL *curl; CURLcode res; struct curl_slist *recipients = NULL; struct upload_status upload_ctx; upload_ctx.lines_read = 0; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, "smtp://gmail.com:587"); curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); curl_easy_setopt(curl, CURLOPT_USERNAME, "xxxxxx@gmail.com"); curl_easy_setopt(curl, CURLOPT_PASSWORD, "xxxxxxxx"); curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM); recipients = curl_slist_append(recipients, TO); recipients = curl_slist_append(recipients, CC); curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); curl_easy_setopt(curl, CURLOPT_READDATA, &amp;upload_ctx); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); res = curl_easy_perform(curl); curl_slist_free_all(recipients); curl_easy_cleanup(curl); } return 0; } </code></pre> <p><br>EDIT<br> Looks like the correct URL should be <code>smtp://smtp.gmail.com:587</code><br> This gets me further, now I am getting<br></p> <pre><code>* About to connect() to smtp.gmail.com port 587 (#0) * Trying 74.125.45.108... * connected &lt; 220 mx.google.com ESMTP j26srtuiopnann.7 &gt; EHLO my_computer_name &lt; 250-mx.google.com at your service, &lt; 250-SIZE 35882577 &lt; 250-8BITMIME &lt; 250-STARTTLS &lt; 250 ENHANCEDSTATUSCODES * No known auth mechanisms supported! &gt; QUIT &lt; 221 2.0.0 closing connection j26srtuiopnann.7 * Closing connection #0 * Login denied </code></pre> <p><br>EDIT<br> Libcurl was not built with SSL support</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload