#include <libetpan/libetpan.h>
struct mailimf_mailbox_list *
mailimf_mailbox_list_new_empty();
int mailimf_mailbox_list_add(struct mailimf_mailbox_list * mailbox_list,
struct mailimf_mailbox * mb);
int mailimf_mailbox_list_add_parse(struct mailimf_mailbox_list * mailbox_list,
char * mb_str);
int mailimf_mailbox_list_add_mb(struct mailimf_mailbox_list * mailbox_list,
char * display_name, char * address);
mailimf_mailbox_list_new_empty() creates a new empty list of mailboxes.
mailimf_mailbox_list_add adds a mailbox to the list of mailboxes.
mailimf_mailbox_list_add_parse adds a mailbox given in form of a string to the list of mailboxes.
mailimf_mailbox_list_add_mb adds a mailbox given in form of a couple : display name, mailbox address.
mailbox_list is the list of mailboxes.
mb is a mailbox (see the Section called mailimf_mailbox - mailbox).
mb_str is a mailbox given in the form of a string.
display_name is the display name.
address is the mailbox address.
Example 3-44. creating a list of mailboxes
#include <libetpan/libetpan.h>
int main(int argc, char ** argv)
{
struct mailimf_mailbox_list * mb_list;
struct mailimf_mailbox * mb;
mb_list = mailimf_mailbox_list_new_empty();
mb = mailimf_mailbox_new(strdup("DINH Viet Hoa"),
strdup("dinh.viet.hoa@free.fr"));
mailimf_mailbox_list_add(mb_list, mb);
mailimf_mailbox_list_add_parse(mb_list, "foo bar <foo@bar.org>");
mailimf_mailbox_list_add_mb(mb_list, strdup("bar foo"), strdup("bar@foo.com"));
mailimf_mailbox_list_free(mb_list);
}
#include <libetpan/libetpan.h>
struct mailimf_address_list * mailimf_address_list_new_empty();
int mailimf_address_list_add(struct mailimf_address_list * address_list,
struct mailimf_address * addr);
int mailimf_address_list_add_parse(struct mailimf_address_list * address_list,
char * addr_str);
int mailimf_address_list_add_mb(struct mailimf_address_list * address_list,
char * display_name, char * address);
mailimf_address_list_new_empty() creates a new empty list of addresses.
mailimf_address_list_add adds an address to the list of addresses.
mailimf_address_list_add_parse adds an address given in form of a string to the list of addresses.
mailimf_address_list_add_mb adds a mailbox given in form of a couple : display name, mailbox address.
address_list is the list of mailboxes.
addr is an address. (see the Section called mailimf_address - address).
addr_str is an address given in the form of a string.
display_name is the display name.
address is the mailbox address.
#include <libetpan/libetpan.h>
struct mailimf_fields *
mailimf_fields_new_empty(void);
struct mailimf_field * mailimf_field_new_custom(char * name, char * value);
int mailimf_fields_add(struct mailimf_fields * fields,
struct mailimf_field * field);
int mailimf_fields_add_data(struct mailimf_fields * fields,
struct mailimf_date_time * date,
struct mailimf_mailbox_list * from,
struct mailimf_mailbox * sender,
struct mailimf_address_list * reply_to,
struct mailimf_address_list * to,
struct mailimf_address_list * cc,
struct mailimf_address_list * bcc,
char * msg_id,
clist * in_reply_to,
clist * references,
char * subject);
struct mailimf_fields *
mailimf_fields_new_with_data_all(struct mailimf_date_time * date,
struct mailimf_mailbox_list * from,
struct mailimf_mailbox * sender,
struct mailimf_address_list * reply_to,
struct mailimf_address_list * to,
struct mailimf_address_list * cc,
struct mailimf_address_list * bcc,
char * message_id,
clist * in_reply_to,
clist * references,
char * subject);
struct mailimf_fields *
mailimf_fields_new_with_data(struct mailimf_mailbox_list * from,
struct mailimf_mailbox * sender,
struct mailimf_address_list * reply_to,
struct mailimf_address_list * to,
struct mailimf_address_list * cc,
struct mailimf_address_list * bcc,
clist * in_reply_to,
clist * references,
char * subject);
char * mailimf_get_message_id(void);
struct mailimf_date_time * mailimf_get_current_date(void);
int
mailimf_resent_fields_add_data(struct mailimf_fields * fields,
struct mailimf_date_time * resent_date,
struct mailimf_mailbox_list * resent_from,
struct mailimf_mailbox * resent_sender,
struct mailimf_address_list * resent_to,
struct mailimf_address_list * resent_cc,
struct mailimf_address_list * resent_bcc,
char * resent_msg_id);
struct mailimf_fields *
mailimf_resent_fields_new_with_data_all(struct mailimf_date_time *
resent_date, struct mailimf_mailbox_list * resent_from,
struct mailimf_mailbox * resent_sender,
struct mailimf_address_list * resent_to,
struct mailimf_address_list * resent_cc,
struct mailimf_address_list * resent_bcc,
char * resent_msg_id);
struct mailimf_fields *
mailimf_resent_fields_new_with_data(struct mailimf_mailbox_list * from,
struct mailimf_mailbox * resent_sender,
struct mailimf_address_list * resent_to,
struct mailimf_address_list * resent_cc,
struct mailimf_address_list * resent_bcc);
from is the parsed content of the From field (see the Section called mailimf_from - parsed content of From header).
sender is the parsed content of the Sender field (see the Section called mailimf_sender - parsed content of Sender header).
reply_to is the parsed content of the Reply-To field (see the Section called mailimf_reply_to - parsed content of Reply-To header).
to is the parsed content of the To field (see the Section called mailimf_to - parsed content of To header).
cc is the parsed content of the Cc field (see the Section called mailimf_cc - parsed content of Cc).
bcc is the parsed content of the Bcc field (see the Section called mailimf_bcc - parsed content of Bcc field).
message_id is the parsed content of the Message-ID field (see the Section called mailimf_message_id - parsed content of Message-ID header).
in_reply_to is the parsed content of the In-Reply-To field (see the Section called mailimf_in_reply_to - parsed content of In-Reply-To field).
references is the parsed content of the References field (see the Section called mailimf_references - parsed content of References field).
subject is the content of the Subject field (see the Section called mailimf_subject - parsed content of Subject field).
resent_date is the parsed content of the Resent-Date field (see the Section called mailimf_orig_date - parsed content of date header).
resent_from is the parsed content of the Resent-From field (see the Section called mailimf_from - parsed content of From header).
resent_sender is the parsed content of the Resent-Sender field (see the Section called mailimf_sender - parsed content of Sender header).
resent_to is the parsed content of the Resent-To field (see the Section called mailimf_to - parsed content of To header).
resent_cc is the parsed content of the Resent-Cc field (see the Section called mailimf_cc - parsed content of Cc).
resent_bcc is the parsed content of the Resent-Bcc field (see the Section called mailimf_bcc - parsed content of Bcc field).
resent_msg_id is the parsed content of the Resent-Message-ID field (see the Section called mailimf_message_id - parsed content of Message-ID header).
mailimf_fields_new_empty() creates a new empty set of headers.
mailimf_field_new_custom() creates a new custom header.
mailimf_fields_add() adds a header to the set of headers.
mailimf_fields_add_data() adds some headers to the set of headers.
mailimf_fields_new_with_data_all() creates a set of headers with some headers (including Date and Message-ID).
mailimf_fields_new_with_data() creates a set of headers with some headers (Date and Message-ID will be generated).
mailimf_get_message_id() generates a Message-ID. The result must be freed using free().
mailimf_get_current_date() generates a Date. The result must be freed using mailimf_date_time_free.
mailimf_resent_fields_add_data() adds some resent headers to the set of headers.
mailimf_resent_fields_new_with_data_all() creates a set of headers with some resent headers (including Resent-Date and Resent-Message-ID).
mailimf_resent_fields_new_with_data() creates a set of headers with some resent headers (Resent-Date and Resent-Message-ID will be generated)
Example 3-45. creation of header fields
#include <libetpan/libetpan.h>
int main(int argc, char ** argv)
{
struct mailimf_fields * fields;
struct mailimf_field * field;
struct mailimf_date_time * date;
char * msg_id;
struct mailimf_mailbox_list * from;
struct mailimf_address_list * to;
fields = mailimf_fields_new_empty();
field = mailimf_field_new_custom(strdup("X-Mailer"), strdup("my-mailer"));
mailimf_fields_add(fields, field);
from = mailimf_mailbox_list_new_empty();
mailimf_mailbox_list_add_mb(from, strdup("DINH Viet Hoa"), strdup("dinh.viet.hoa@free.fr");
date = mailimf_get_current_date();
msg_id = mailimf_get_message_id();
to = mailimf_address_list_new_empty();
mailimf_address_list_add_mb(to, strdup("FOO Bar"), strdup("foo@bar.org");
mailimf_fields_add_data(fields, date, from, NULL, NULL, to, NULL, NULL,
msg_id, NULL, NULL, strdup("hello"));
/* do the things */
mailimf_fields_free(fields);
}
#include <libetpan/libetpan.h>
int main(int argc, char ** argv)
{
struct mailimf_fields * fields;
struct mailimf_mailbox_list * from;
struct mailimf_address_list * to;
struct mailimf_date_time * date;
char * msg_id;
from = mailimf_mailbox_list_new_empty();
mailimf_mailbox_list_add_mb(from, strdup("DINH Viet Hoa"), strdup("dinh.viet.hoa@free.fr");
to = mailimf_address_list_new_empty();
mailimf_address_list_add_mb(to, strdup("FOO Bar"), strdup("foo@bar.org");
date = mailimf_get_current_date();
msg_id = mailimf_get_message_id();
fields = mailimf_fields_new_with_all_data(date, from, NULL, NULL, to, NULL, NULL,
msg_id, NULL, NULL, strdup("hello"));
/* do the things */
mailimf_fields_free(fields);
}
#include <libetpan/libetpan.h>
int main(int argc, char ** argv)
{
struct mailimf_fields * fields;
struct mailimf_mailbox_list * from;
struct mailimf_address_list * to;
from = mailimf_mailbox_list_new_empty();
mailimf_mailbox_list_add_mb(from, strdup("DINH Viet Hoa"), strdup("dinh.viet.hoa@free.fr");
to = mailimf_address_list_new_empty();
mailimf_address_list_add_mb(to, strdup("FOO Bar"), strdup("foo@bar.org");
fields = mailimf_fields_new_with_data(from, NULL, NULL, to, NULL, NULL,
NULL, NULL, strdup("hello"));
/* do the things */
mailimf_fields_free(fields);
}