Re: Mail From option in PHP.ini

From: Date: Fri, 18 Jul 2003 15:29:39 +0000
Subject: Re: Mail From option in PHP.ini
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155783@lists.php.net to get a copy of this message
On Fri, Jul 18, 2003 at 11:00:18AM -0400, Brian S. Drexler wrote: > > Ok, I want to specify who the mail is coming from by using the sendmail_path > option in the PHP.ini. I've added the -fme@mydomain.com to it, but I want > to be able to dynmaically change me@mydomain.com to you@mydomain.com or > whatever else. Anyone have any ideas how I can do this? I'm pulling the > e-mail I'd like to change it to from a MySQL database but can I rewrite the > php.ini file on the fly or am I stuck. Any help is greatly appreciated. You can't change the Return-Path header, because it's not set by the sender. It's added by the *receiving* mail server, and reflects the from address in the SMTP envelope, rather than anything in the headers of the message itself. It sounds heinous, but one solution might be to make your sendmail_path a *wrapper* that will look at certain environment variables and come up with a -f option with which to launch sendmail. I don't recommend this solution. Another possibility might be to run PHP inside FastCGI and use suexec. If the PHP script is being executed this way, I would think that any sendmail processe launched would have the username in the envelope-from. You also might get a performance gain by doing things through FastCGI, though you'd lose some of the module-specific features like persistent database connections. Worth testing, anyway. Let us know how it goes. :) -- Paul Chvostek <paul@it.ca> it.canada http://www.it.ca/ Free PHP web hosting! http://www.it.ca/web/

« previous php.general (#155783) next »