cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl:SMTP: segmentation fault in curl_perform

From: <devyani.sapre_at_wipro.com>
Date: Thu, 8 Apr 2010 14:27:49 +0530

Hi All,
 
I am trying the libcurl SMTP support for sending out mails, but I get a
segmentation fault in curl_perform().
 
Below is the code snippet and trace of the seg fault :
 
"
"
fd = fopen("./text", "rb"); /* open file to upload */
 
         curl = curl_easy_init();
        if (curl){
                        printf(" setting options\n");
                  curl_easy_setopt(curl,CURLOPT_VERBOSE , 1);
                  curl_easy_setopt(curl,CURLOPT_READDATA, fd);
 
curl_easy_setopt(curl,CURLOPT_URL,"smtp://10.200.53.98");
                  curl_easy_setopt(curl,CURLOPT_MAIL_FROM, sender
<mailto:sender_at_wipro.com> @wipro.com <mailto:sender_at_wipro.com> );
                  curl_easy_setopt(curl,CURLOPT_MAIL_RCPT,
"devyani.sapre_at_wipro.com <mailto:devyani.sapre_at_wipro.com> ");
 
                  res = curl_easy_perform(curl);
                   curl_easy_cleanup(curl);
        }
"
"
 
The text file contains: Hi hello world.
 
Back Trace :
 
#0 0x00000032052796d0 in strlen () from /lib64/libc.so.6
#1 0x00002ae56892ef1a in dprintf_formatf () from
/usr/local/lib/libcurl.so.4
#2 0x00002ae56892ff52 in curl_maprintf () from
/usr/local/lib/libcurl.so.4
#3 0x00002ae5689419ee in smtp_statemach_act () from
/usr/local/lib/libcurl.so.4
#4 0x00002ae56894137f in smtp_easy_statemach () from
/usr/local/lib/libcurl.so.4
#5 0x00002ae568941bfa in smtp_do () from /usr/local/lib/libcurl.so.4
#6 0x00002ae568927329 in Curl_do () from /usr/local/lib/libcurl.so.4
#7 0x00002ae568933fb5 in Curl_perform () from
/usr/local/lib/libcurl.so.4
#8 0x0000000000443e01 in send_msg (msg=0x0) at transfer.c:21

What could be wrong? Please suggest.
 
I was able to successfully send a mail using the curl commandline tool.
 
Thanks
Devyani
 

Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-08