From: Bernhard Walle Subject: [PATCH] Allow multiple Cc and Bcc header calls This patch modifies the library so that smtp_set_header() can be called multiple times. One header will be generated with a comma-separated list of values. That's the behaviour as described in the API documentation at http://www.stafford.uklinux.net/libesmtp/api.html. Signed-off-by: Bernhard Walle --- headers.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/headers.c +++ b/headers.c @@ -273,7 +273,7 @@ set_from (struct rfc2822_header *header, return 1; } -/* Print header-name ": " mailbox "\r\n" +/* Print header-name ": " mailbox "\r\n" or header-name ": \"" phrase "\" <" mailbox ">\r\n" */ static void print_from (smtp_message_t message, struct rfc2822_header *header) @@ -340,7 +340,7 @@ set_sender (struct rfc2822_header *heade /* TODO: do nothing if the mailbox is NULL. Check this doesn't fool the protocol engine into thinking it has seen end of file. */ -/* Print header-name ": " mailbox "\r\n" +/* Print header-name ": " mailbox "\r\n" or header-name ": \"" phrase "\" <" mailbox ">\r\n" */ static void @@ -414,7 +414,7 @@ set_cc (struct rfc2822_header *header, v return 1; } -/* Print header-name ": " mailbox "\r\n" +/* Print header-name ": " mailbox "\r\n" or header-name ": \"" phrase "\" <" mailbox ">\r\n" ad nauseum. */ static void @@ -508,9 +508,9 @@ static const struct header_actions heade set_sender, print_sender, destroy_mbox_list, }, { "To", OPTIONAL, set_to, print_to, destroy_mbox_list, }, - { "Cc", OPTIONAL, + { "Cc", OPTIONAL | LISTVALUE, set_cc, print_cc, destroy_mbox_list, }, - { "Bcc", OPTIONAL, + { "Bcc", OPTIONAL | LISTVALUE, set_cc, print_cc, destroy_mbox_list, }, { "Reply-To", OPTIONAL, set_cc, print_cc, destroy_mbox_list, }, @@ -760,7 +760,7 @@ missing_header (smtp_message_t message, if (print == NULL) print = print_string; - + cat_reset (&message->hdr_buffer, 0); (*print) (message, message->current_header); return cat_buffer (&message->hdr_buffer, len);