RE: [Exim] Changing "Sender" header

Top Page
Delete this message
Reply to this message
Author: Eli
Date:  
To: exim-users, 'Joe Peifer'
Subject: RE: [Exim] Changing "Sender" header
>- Better, is a method I only started playing around the other day (mainly
>inspired by a post here from Eli), where for each vhost in your Apache
>config you have something like:


It's working *great* by the way... I don't use -f, this is what I have in my
VirtualHost config section (for a specific domain):


php_admin_value sendmail_path "SERVER_NAME='domain.com' /usr/sbin/sendmail
-t -i"


You could theoretically set any environment variable you want - I chose
SERVER_NAME because it's a CGI standard, and it's the best way in my
situation to distinguish accounts.

Apply my environment variable patch to Exim:
http://nutbar.chemlab.org/downloads/other/env-exim-4.30-2.patch

Then you'll want this in your main config area:


acl_not_smtp                    = acl_check_pipe



And this in your ACL section:


acl_check_pipe:
        warn    message         = X-Headers-Begin: $message_id
        warn    condition       = ${if def:env_REMOTE_ADDR {yes}{no}}
                message         = X-CGI-Client: $env_REMOTE_ADDR
                logwrite        = X-CGI-Client: $env_REMOTE_ADDR
        warn    condition       = ${if def:env_SERVER_NAME {yes}{no}}
                message         = X-CGI-Server: $env_SERVER_NAME
($env_SERVER_ADDR)
                logwrite        = X-CGI-Server: $env_SERVER_NAME
($env_SERVER_ADDR)
        warn    condition       = ${if def:env_SCRIPT_NAME {yes}{no}}
                message         = X-CGI-Script: $env_SCRIPT_NAME
($env_SCRIPT_FILENAME)
                logwrite        = X-CGI-Script: $env_SCRIPT_NAME
($env_SCRIPT_FILENAME)
        warn    message         = X-Headers-End: $message_id
        accept



I have the other CGI variables there so that real CGI emails log more data
(very useful by the way). So far, 3 webservers with roughly 400 sites each
- no crashing, 100% perfect!

Also, lastly to *really* fix your problem, you want this in your rewrite
section:


    *@$primary_hostname             $rheader_from:                  F



That rewrites your sender envelope address to be the value in the From:
header. You have to of course now watch out for potential spammers on your
system faking the From: address to something they shouldn't. However, since
chances are that httpuser@??? is NOT a true valid email
account address, and you're finding that servers that do sender callout
verification are failing. Rewriting the sender address this way at least
allows people to specify a valid account - and you also get a TON less
internal bounces due to denied email.

Eli.

-----Original Message-----
From: exim-users-admin@??? [mailto:exim-users-admin@exim.org] On Behalf
Of Tim Jackson
Sent: Wednesday, February 04, 2004 5:02 AM
To: exim-users@???
Subject: Re: [Exim] Changing "Sender" header


Hi Joe, on Wed, 04 Feb 2004 00:10:21 -0500 you wrote:

> I want the header info of email generated by a PHP script to change
> depending on the virtual domain that generates the request. Is there an
> simple way to do this? If you're kind enough to respond to this
> question, please go easy... I'm fresh to Exim.


OK, you have two main choices:

- When the mail() function from PHP is called, a fifth parameter is added
"-f<WHATEVER>" where "<WHATEVER>" is the e-mail address to be used as the
sender. This will require that the user that Apache runs as is in Exim's
trusted user list.

- Better, is a method I only started playing around the other day (mainly
inspired by a post here from Eli), where for each vhost in your Apache
config you have something like:

php_admin_value sendmail_path "sendmail -t -i -fsender@domain"


Additional to this, you might be interested in this message by Eli, where
he supplies an Exim patch which allows you to read environment variables
(and hence determine which script sent a message):

<000301c3df95$5df95b90$0a00a8c0@eli>



Tim

--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim
details at http://www.exim.org/ ##