gmime-message

Name

gmime-message -- 

Synopsis



#define     GMIME_RECIPIENT_TYPE_TO
#define     GMIME_RECIPIENT_TYPE_CC
#define     GMIME_RECIPIENT_TYPE_BCC
struct      GMimeMessage;
GMimeMessage* g_mime_message_new            (gboolean pretty_headers);
void        g_mime_message_set_sender       (GMimeMessage *message,
                                             const char *sender);
const char* g_mime_message_get_sender       (GMimeMessage *message);
void        g_mime_message_set_reply_to     (GMimeMessage *message,
                                             const char *reply_to);
const char* g_mime_message_get_reply_to     (GMimeMessage *message);
void        g_mime_message_add_recipient    (GMimeMessage *message,
                                             char *type,
                                             const char *name,
                                             const char *address);
void        g_mime_message_add_recipients_from_string
                                            (GMimeMessage *message,
                                             char *type,
                                             const char *string);
InternetAddressList* g_mime_message_get_recipients
                                            (GMimeMessage *message,
                                             const char *type);
void        g_mime_message_set_subject      (GMimeMessage *message,
                                             const char *subject);
const char* g_mime_message_get_subject      (GMimeMessage *message);
void        g_mime_message_set_date         (GMimeMessage *message,
                                             time_t date,
                                             int gmt_offset);
void        g_mime_message_get_date         (GMimeMessage *message,
                                             time_t *date,
                                             int *gmt_offset);
char*       g_mime_message_get_date_string  (GMimeMessage *message);
void        g_mime_message_set_message_id   (GMimeMessage *message,
                                             const char *message_id);
const char* g_mime_message_get_message_id   (GMimeMessage *message);
void        g_mime_message_add_header       (GMimeMessage *message,
                                             const char *header,
                                             const char *value);
void        g_mime_message_set_header       (GMimeMessage *message,
                                             const char *header,
                                             const char *value);
const char* g_mime_message_get_header       (GMimeMessage *message,
                                             const char *header);
void        g_mime_message_set_mime_part    (GMimeMessage *message,
                                             GMimeObject *mime_part);
ssize_t     g_mime_message_write_to_stream  (GMimeMessage *message,
                                             GMimeStream *stream);
char*       g_mime_message_to_string        (GMimeMessage *message);
char*       g_mime_message_get_body         (const GMimeMessage *message,
                                             gboolean want_plain,
                                             gboolean *is_html);
char*       g_mime_message_get_headers      (GMimeMessage *message);
void        g_mime_message_foreach_part     (GMimeMessage *message,
                                             GMimePartFunc callback,
                                             gpointer data);


Object Hierarchy


  GObject
   +----GMimeObject
         +----GMimeMessage

Description

Details

GMIME_RECIPIENT_TYPE_TO

#define	GMIME_RECIPIENT_TYPE_TO  "To"

Recipients in the To: header.


GMIME_RECIPIENT_TYPE_CC

#define	GMIME_RECIPIENT_TYPE_CC  "Cc"

Recipients in the Cc: header.


GMIME_RECIPIENT_TYPE_BCC

#define	GMIME_RECIPIENT_TYPE_BCC "Bcc"

Recipients in the Bcc: header.


struct GMimeMessage

struct GMimeMessage;


g_mime_message_new ()

GMimeMessage* g_mime_message_new            (gboolean pretty_headers);

If pretty_headers is TRUE, then the standard rfc822 headers are initialized so as to put headers in a nice friendly order. This is strictly a cosmetic thing, so if you are unsure, it is safe to say no (FALSE).

pretty_headers :

make pretty headers

Returns :

an empty MIME Message object.


g_mime_message_set_sender ()

void        g_mime_message_set_sender       (GMimeMessage *message,
                                             const char *sender);

Set the sender's name and address on the MIME Message. (ex: "\"Joe Sixpack\" <joesixpack.org>")

message :

MIME Message to change

sender :

The name and address of the sender


g_mime_message_get_sender ()

const char* g_mime_message_get_sender       (GMimeMessage *message);

Gets the email address of the sender from message.

message :

MIME Message

Returns :

the sender's name and address of the MIME Message.


g_mime_message_set_reply_to ()

void        g_mime_message_set_reply_to     (GMimeMessage *message,
                                             const char *reply_to);

Set the sender's Reply-To address on the MIME Message.

message :

MIME Message to change

reply_to :

The Reply-To address


g_mime_message_get_reply_to ()

const char* g_mime_message_get_reply_to     (GMimeMessage *message);

Gets the Reply-To address from message.

message :

MIME Message

Returns :

the sender's Reply-To address from the MIME Message.


g_mime_message_add_recipient ()

void        g_mime_message_add_recipient    (GMimeMessage *message,
                                             char *type,
                                             const char *name,
                                             const char *address);

Add a recipient of a chosen type to the MIME Message. Available recipient types include: GMIME_RECIPIENT_TYPE_TO, GMIME_RECIPIENT_TYPE_CC and GMIME_RECIPIENT_TYPE_BCC.

message :

MIME Message to change

type :

Recipient type

name :

The recipient's name

address :

The recipient's address


g_mime_message_add_recipients_from_string ()

void        g_mime_message_add_recipients_from_string
                                            (GMimeMessage *message,
                                             char *type,
                                             const char *string);

Add a list of recipients of a chosen type to the MIME Message. Available recipient types include: GMIME_RECIPIENT_TYPE_TO, GMIME_RECIPIENT_TYPE_CC and GMIME_RECIPIENT_TYPE_BCC. The string must be in the format specified in rfc822.

message :

MIME Message

type :

Recipient type

string :

A string of recipient names and addresses.


g_mime_message_get_recipients ()

InternetAddressList* g_mime_message_get_recipients
                                            (GMimeMessage *message,
                                             const char *type);

Gets a list of recipients of type type from message. Available recipient types include: GMIME_RECIPIENT_TYPE_TO, GMIME_RECIPIENT_TYPE_CC and GMIME_RECIPIENT_TYPE_BCC.

message :

MIME Message

type :

Recipient type

Returns :

a list of recipients of a chosen type from the MIME Message.


g_mime_message_set_subject ()

void        g_mime_message_set_subject      (GMimeMessage *message,
                                             const char *subject);

Set the Subject field on a MIME Message.

message :

MIME Message

subject :

Subject string


g_mime_message_get_subject ()

const char* g_mime_message_get_subject      (GMimeMessage *message);

Gets the message's subject.

message :

MIME Message

Returns :

the Subject field on a MIME Message.


g_mime_message_set_date ()

void        g_mime_message_set_date         (GMimeMessage *message,
                                             time_t date,
                                             int gmt_offset);

Sets the sent-date on a MIME Message.

message :

MIME Message

date :

Sent-date (ex: gotten from time (NULL))

gmt_offset :

GMT date offset (in +/- hours)


g_mime_message_get_date ()

void        g_mime_message_get_date         (GMimeMessage *message,
                                             time_t *date,
                                             int *gmt_offset);

Stores the date in time_t format in date and the GMT offset in gmt_offset.

message :

MIME Message

date :

Sent-date

gmt_offset :

GMT date offset (in +/- hours)


g_mime_message_get_date_string ()

char*       g_mime_message_get_date_string  (GMimeMessage *message);

Gets the message's sent date in string format.

message :

MIME Message

Returns :

the sent-date of the MIME Message in string format.


g_mime_message_set_message_id ()

void        g_mime_message_set_message_id   (GMimeMessage *message,
                                             const char *message_id);

Set the Message-Id on a message.

message :

MIME Message

message_id :

message-id (addr-spec portion)


g_mime_message_get_message_id ()

const char* g_mime_message_get_message_id   (GMimeMessage *message);

Gets the Message-Id header of message.

message :

MIME Message

Returns :

the Message-Id of a message.


g_mime_message_add_header ()

void        g_mime_message_add_header       (GMimeMessage *message,
                                             const char *header,
                                             const char *value);

Add an arbitrary message header to the MIME Message such as X-Mailer, X-Priority, or In-Reply-To.

message :

MIME Message

header :

rfc822 header field

value :

the contents of the header field


g_mime_message_set_header ()

void        g_mime_message_set_header       (GMimeMessage *message,
                                             const char *header,
                                             const char *value);

Set an arbitrary message header to the MIME Message such as X-Mailer, X-Priority, or In-Reply-To.

message :

MIME Message

header :

rfc822 header field

value :

the contents of the header field


g_mime_message_get_header ()

const char* g_mime_message_get_header       (GMimeMessage *message,
                                             const char *header);

Gets the value of the requested header header if it exists, or NULL otherwise.

message :

MIME Message

header :

rfc822 header field

Returns :

the value of the requested header (or NULL if it isn't set)


g_mime_message_set_mime_part ()

void        g_mime_message_set_mime_part    (GMimeMessage *message,
                                             GMimeObject *mime_part);

Set the root-level MIME part of the message.

message :

MIME Message

mime_part :

The root-level MIME Part


g_mime_message_write_to_stream ()

ssize_t     g_mime_message_write_to_stream  (GMimeMessage *message,
                                             GMimeStream *stream);

Write the contents of the MIME Message to stream.

message :

MIME Message

stream :

output stream

Returns :

-1 on fail.


g_mime_message_to_string ()

char*       g_mime_message_to_string        (GMimeMessage *message);

Allocates a string buffer containing the mime message message.

message :

MIME Message

Returns :

an allocated string containing the MIME Message.


g_mime_message_get_body ()

char*       g_mime_message_get_body         (const GMimeMessage *message,
                                             gboolean want_plain,
                                             gboolean *is_html);

Attempts to get the body of the message in the preferred format specified by want_plain.

message :

MIME Message

want_plain :

request text/plain

is_html :

body returned is in html format

Returns :

the prefered form of the message body. Sets the value of is_html to TRUE if the part returned is in HTML format, otherwise FALSE. Note: This function is NOT guarenteed to always work as it makes some assumptions that are not necessarily true. It is recommended that you traverse the MIME structure yourself.


g_mime_message_get_headers ()

char*       g_mime_message_get_headers      (GMimeMessage *message);

Allocates a string buffer containing the raw message headers.

message :

MIME Message

Returns :

an allocated string containing the raw message headers.


g_mime_message_foreach_part ()

void        g_mime_message_foreach_part     (GMimeMessage *message,
                                             GMimePartFunc callback,
                                             gpointer data);

Calls callback on each of the mime parts in the mime message.

message :

MIME message

callback :

function to call on each of the mime parts contained by the mime message

data :

extra data to pass to the callback