Gallai János via Exim-users <exim-users@???> (Fr 22 Jun 2018 11:36:16 CEST):
> Dear Heiko,
>
> I've tried envelope_sender but Exim says unknow variable.
>
> The goal is: We would like to use a separate smarthost for specified domains
> on real sender ( envelope_sender ) which is in the From: header.
The envelope sender doesn't have to match the From: header, as From: may
contain multiple addresses. If so, Sender: should exist and contain only
one address.
> For example: many users use webmail where the sender is www@???, the
> real sender is user@???. There is no problem with MUAs but
Yes, I'd consider this as a misconfiguration of the webmailer.
Most people do not care, because the do not know anything about envelope
senders. The same is true for MUAs. And for replies normal MUAs use the
From: header (or Reply-to:, if available).
The envelope sender is used for bounces. And even webmail users should
get the bounces they triggger. But with having www@??? as
envelope sender, there is no chance.
So - you should try hard to set the envelope sender to the address of
the "responsive" originating user.
> webmail users always send mail with sender www@??? so the real sender
> is in the From: header. I need to get this address somehow.
The variables you need are
$sender_address
$sender_address_local_part
$sender_address_domain
…
> smarthost:
> driver = manualroute
> debug_print = Domain: From: ${local_part}@${domain}, Sender: $header_From
> domains = ! pgsql;SELECT nev FROM domain WHERE nev =
> '${quote_pgsql:$domain}' AND local = 1
> condition = ${if match_domain{${domain:$h_From:}}{lookup pgsql{SELECT nev
> FROM domain WHERE nev = '${domain:$h_From:}' AND relay = 1}{yes}{no}}}
> transport = remote_smtp
> route_data = XXX.XXX.XXX.XXX
> no_verify
> no_more
>
> If I run the SQL-query manually it works fine: gives me back that expected.
> I understand that I do something wrong but what?
How to you test your setup?
--
Heiko