cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problems sending mail about smtp

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 12 Nov 2010 00:05:10 -0800

On Fri, Nov 12, 2010 at 09:23:29AM +0800, IJÁÖº£ wrote:
> Hello
> When I use smtp to send mail, there will be following the situation, before the
> use of no such situation, I think that not sending HELO to continue to the
> other¡£
> This is the code I write, is there a mistake?
>
> curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
> curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
> curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
> curl_easy_setopt(curl, CURLOPT_URL, "smtp.gmail.com");

The mistake is in this line: the value you set is not a URL. Therefore,
curl guesses what protocol you're asking for and in this case it guesses
wrong. Use an SMTP URL here, like smtp://smtp.gmail.com

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-12