Re: [exim] Extract email address from From header

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Dean Brooks
Data:  
Para: exim-users
CC: Marc Perkel
Assunto: Re: [exim] Extract email address from From header
On Sun, Jan 08, 2006 at 08:11:35AM -0800, Marc Perkel wrote:

> Exim really should have a "from_address" command then. Really - does
> this have to be that hard? I can't be the first one who tried to extract
> the email address from the From header without using perl. Or is there
> some easy trick I'm missing?


The mechanism is already in there:

${address:$h_from:}

From spec.txt:

 ${address:<string>}
    The string is interpreted as an RFC 2822 address, as it might appear in a
    header line, and the effective address is extracted from it. If the string
    does not parse successfully, the result is empty.


From this you could extract the domain or the local part as:

${domain:${address:$h_from:}}
${local_part:${address:$h_from:}}

Regards,

Dean Brooks
dean@???