Re: [gmime-devel] compose email



On 04/21/2010 11:27 AM, Simone Fausti wrote:
> Hi, is possible to have an example about how is possible to compose a
> new email with attachement?
>   

In the source tarballs of GMime, you can find a sample program in the
examples/ directory called basic-example.c (although imap-example.c
might also be useful for you to look over). In basic-example.c, there is
a function called add_a_mime_part() that you might find useful.

If you are creating a simple email message with a text part for the body
and any number of attachments, you  can use a simple MIME structure such as:

GMimeMessage
  GMimeMultipart ("mixed")
    GMimePart (text part)
    GMimePart (attachment)

Generally you'll want to mark the text part as "inline" and the
attachments as "attachment". To do this, use
g_mime_object_set_disposition().

Example:

g_mime_object_set_disposition ((GMimeObject *) text_part, "inline");
g_mime_object_set_disposition ((GMimeObject *) attachment_part,
"attachment");

Jeff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]