GMimeMessage

GMimeMessage — Messages

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GMimeObject
        ╰── GMimeMessage

Description

A GMimeMessage represents an rfc822 message.

Functions

g_mime_message_new ()

GMimeMessage *
g_mime_message_new (gboolean pretty_headers);


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 >")

Parameters

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 .

Parameters

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.

Parameters

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 .

Parameters

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,
                              GMimeRecipientType type,
                              const char *name,
                              const char *addr);

Add a recipient of a chosen type to the MIME Message.

Parameters

message

MIME Message to change

 

type

A GMimeRecipientType

 

name

The recipient's name (or NULL)

 

addr

The recipient's address

 

g_mime_message_get_recipients ()

InternetAddressList *
g_mime_message_get_recipients (GMimeMessage *message,
                               GMimeRecipientType type);

Gets a list of recipients of type type from message .

Parameters

message

MIME Message

 

type

A GMimeRecipientType

 

Returns

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


g_mime_message_get_all_recipients ()

InternetAddressList *
g_mime_message_get_all_recipients (GMimeMessage *message);

Gets the complete list of recipients for message .

Parameters

message

MIME Message

 

Returns

a newly allocated InternetAddressList containing all recipients of the message or NULL if no recipients are set.


g_mime_message_set_subject ()

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

Set the unencoded UTF-8 Subject field on a MIME Message.

Parameters

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.

Parameters

message

MIME Message

 

Returns

the unencoded UTF-8 Subject field on a MIME Message.


g_mime_message_set_date ()

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

Sets the Date header on a MIME Message.

Parameters

message

MIME Message

 

date

a date to be used in the Date header

 

tz_offset

timezone offset (in +/- hours)

 

g_mime_message_get_date ()

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

Stores the date in time_t format in date . If tz_offset is non-NULL, then the timezone offset in will be stored in tz_offset .

Parameters

message

MIME Message

 

date

pointer to a date in time_t

 

tz_offset

pointer to timezone offset (in +/- hours)

 

g_mime_message_set_date_as_string ()

void
g_mime_message_set_date_as_string (GMimeMessage *message,
                                   const char *str);

Sets the sent-date of the message.

Parameters

message

MIME Message

 

str

a date string

 

g_mime_message_get_date_as_string ()

char *
g_mime_message_get_date_as_string (GMimeMessage *message);

Gets the message's sent-date in string format.

Parameters

message

MIME Message

 

Returns

a newly allocated string containing the Date header value.


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.

Parameters

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 .

Parameters

message

MIME Message

 

Returns

the Message-Id of a message.


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.

Parameters

message

MIME Message

 

mime_part

The root-level MIME Part

 

g_mime_message_get_mime_part ()

GMimeObject *
g_mime_message_get_mime_part (GMimeMessage *message);

Gets the toplevel MIME part contained within message .

Parameters

message

MIME Message

 

Returns

the toplevel MIME part of message .


g_mime_message_foreach ()

void
g_mime_message_foreach (GMimeMessage *message,
                        GMimeObjectForeachFunc callback,
                        gpointer user_data);

Recursively calls callback on each of the mime parts in the mime message.

Parameters

message

a GMimeMessage

 

callback

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

 

user_data

user-supplied callback data

 

Types and Values

enum GMimeRecipientType

A message recipient type.

Members

GMIME_RECIPIENT_TYPE_TO

Represents the recipients in the To: header.

 

GMIME_RECIPIENT_TYPE_CC

Represents the recipients in the Cc: header.

 

GMIME_RECIPIENT_TYPE_BCC

Represents the recipients in the Bcc: header.

 

struct GMimeMessage

struct GMimeMessage;

A MIME Message object.

Members