cURL / Mailing Lists / curl-library / Single Mail

curl-library

testing for connectivity to the SMTP server using libcurl APIs

From: Chandran, Naveen <naveen.chandran_at_hp.com>
Date: Thu, 22 Nov 2012 11:52:39 +0000

Hi all,

Please let me know if there is a way to test for proper SMTP server connectivity using libcurl 'without actually sending an email'.
Although this could otherwise be done with a simple telnet EHLO (or HELO), I would like to know if it can be accomplished using the libcurl API(s).

My presumption was that, after setting up the SMTP server URL (using CURLOPT_URL), attempting just a 'FROM' alone (using CURLOPT_MAIL_FROM) would suffice.
However, doing so sort of causes the code to get stalled (and then, eventually time out), probably because the library is expecting the 'RCPT' and/or 'DATA' values too, in order to round up on the easy_perform.

When tried with the attached sample code, (with curl v7.23.1), I do observe the salutations come from the SMTP server on the other end, which then verifies the sender address with a 250 OK,
but just stalls after that.

Appreciate if any of you could throw some light on how I could possibly go about it. Thanks in advance.

Regards,
Naveen

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2012-11-22