cURL / Mailing Lists / curl-library / Single Mail


libcurl:SMTP: segmentation fault in curl_perform

From: <>
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_MAIL_FROM, sender
<> <> );
" <> ");
                  res = curl_easy_perform(curl);
The text file contains: Hi hello world.
Back Trace :
#0 0x00000032052796d0 in strlen () from /lib64/
#1 0x00002ae56892ef1a in dprintf_formatf () from
#2 0x00002ae56892ff52 in curl_maprintf () from
#3 0x00002ae5689419ee in smtp_statemach_act () from
#4 0x00002ae56894137f in smtp_easy_statemach () from
#5 0x00002ae568941bfa in smtp_do () from /usr/local/lib/
#6 0x00002ae568927329 in Curl_do () from /usr/local/lib/
#7 0x00002ae568933fb5 in Curl_perform () from
#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.

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.

List admin:
Received on 2010-04-08