cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl smtp terminates with HELP

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 29 Sep 2016 16:35:18 -0400

On 9/29/2016 3:56 AM, Ove Kernell wrote:
>
> 2016/09/29 09:24:50.876: => Send header (data-size: 6/0x0006)
>
> 0000: HELP
>
> 2016/09/29 09:24:50.876: <= Recv header (data-size: 36/0x0024)
>
> 0000: 214 Help system currently inactive
>
> 2016/09/29 09:24:50.876: Connection #0 to host 192.71.73.36 left intact
>
> What are the possible causes for libcurl to decide to send HELP? Is it
> a signal of libcurl considering an error has occurred
>
> and does libcurl act on the reply?
>
> I see sessions logged from other clients (non-libcurl) and they start
> exactly the same but instead of HELP they proceed with
>
> MAIL FROM after the reply from EHLO.
>

HELP is a default command for SMTP. To send mail you need to use at
least --mail-rcpt [1] / CURLOPT_MAIL_RCPT [2] for curl / libcurl. And
you may need --mail-from / CURLOPT_MAIL_FROM depending on the server.

   struct curl_slist *slist1 = NULL;
   slist1 = curl_slist_append(slist1, "my_username_at_gmail.com");
   curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
   curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "my_username_at_gmail.com");

libcurl example: https://curl.haxx.se/libcurl/c/smtp-mail.html . You may
need to remove the message ID line so that the server generates it,
because using the same message id repeatedly can cause problems.

curl example:

$ cat << EOF > message
From: "my_username" <my_username_at_gmail.com>
To: "my_username" <my_username_at_gmail.com>
Subject: foo

bar
EOF

$ curl -u my_username:my_password --mail-rcpt my_username_at_gmail.com -T
message smtps://smtp.gmail.com
   % Total % Received % Xferd Average Speed Time Time Time Current
                                  Dload Upload Total Spent Left Speed
100 104 0 0 100 104 0 15 0:00:06 0:00:06
--:--:-- 28

(Note: Technically gmail will send without From/To/Subject lines in
message but if you don't use those then it's a BCC without a subject and
there's a likelihood it could be flagged as spam. I'm not sure about
other servers.)

[1]: https://curl.haxx.se/docs/manpage.html#--mail-rcpt
[2]: https://curl.haxx.se/libcurl/c/CURLOPT_MAIL_RCPT.html

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-09-29