[Dovecot] Getting the Sender from a Email

2010-11-10 Thread Alex Baule
Hi Timo


I need to get the Sender from a Email.

Using this mail_get_first_header(mail, From, header) , i get the email in
this format Name u...@dom , in dovecot there is a way to get only the
u...@dom ?

Tks !


Re: [Dovecot] Getting the Sender from a Email

2010-11-10 Thread Timo Sirainen
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 u...@dom , in dovecot there is a way to get only the
 u...@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, addr-mailbox, addr-domain);