[Dovecot] Getting the Sender from a Email

Timo Sirainen tss at iki.fi
Wed Nov 10 21:37:19 EET 2010


On Wed, 2010-11-10 at 17:09 -0200, Alex Baule wrote:

> Using this mail_get_first_header(mail, "From", &header) , i get the email in
> this format "Name <user at dom>" , in dovecot there is a way to get only the
> user at dom ?

Use lib-mail/message-address.h parser, something like:

struct message_address *addr;
addr = message_address_parse(pool_datastack_create(), header, strlen(header), 1, FALSE);
if (addr != NULL) printf("%s@%s", addr->mailbox, addr->domain);




More information about the dovecot mailing list