cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to send email with attachment?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 6 Feb 2013 15:28:14 +0100 (CET)

On Wed, 6 Feb 2013, Malay Gopani wrote:

> I am using curl library to sent an email.

Then curl-library is probably the list for you. This list is for the curl
tool...

> For that I have read the examples folder. From that I am using smtp-multi.c
> and smtp-tls.c. Using this c file I am able to send an email but I don't
> know how to send an attachment with that email.

curl and libcurl supports SMTP fine but you need to provide the "body" of the
mail. In a case when you want to send an attachment, you need to properly
format such content. RFC2045 is a good start to understanding the mechanisms.

If you just look at a raw mail you've received with an attachment you will see
how it can look.

There are many tools and libraries out there already that can help you
generate a full MIME mail that can be sent.

If someone comes up with a decent example snippet, I wouldn't mind adding such
an example to the libcurl examples collection for future users!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-06