Re: PHP4: extra headers in mail() ?

From: Date: Tue, 05 Dec 2000 09:07:18 +0000
Subject: Re: PHP4: extra headers in mail() ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28700@lists.php.net to get a copy of this message
NOTE: mail() ALWAYS returns true - so doing checks is usually not a good thing with mail(). --Joe On Tue, Dec 05, 2000 at 12:45:22AM -0800, Sean Straw / PSE wrote: > > More specifically, how to override headers which seem to be generated by > the system: > > Let's say http(s)d runs as user 'webadmin'. Then, try as I might, the > Return-Path header will be <webadmin@domain> -- what if, for the purpose of > a db-based notification system, I'd like to have the Return-Path header set > to something which will more acurratley identify which user bounced the > message (anyone who's run a large mailing list knows what a PITA > nonstandard email implementations and forwards are for listadmins) -- for > instance: > > $DBname = "somedatabase"; > $mailSubject = "as appropriate to the notification"; > $mailBody = "would have been provided"; > > // (do database calls to get email addresses, looping on each one) > // for simplicity, assume the following two keys are retrieved from > // the database: > $userAddress = "someschumuck@otherdomain"; > $userDBkey = "028361257623"; // some hashed keyvalue > > // generate checkdigits (used to help the bounce processor POSITIVELY > // validate the userdb key before ever performing a db lookup. This > // also helps foil forged bounces (just in case), since a bounce cannot > // be generated merely by changing the db key sequence). > $userDBcheck = gencheckcode($userDBkey); > > $mailHeaders = "Return-Path: > MailProc-$DBname-$userDBkey-$userDBcheck@ourdomain\n"; > > if ( mail( $userAddress, $mailSubject, $mailBody, $mailHeaders ) ) > { > // success > } > else > { > // log an error event, and perhaps how far along we got > // in case a resume can be manually invoked. > } > > > The Return-Path is important to be able to set, because it is where a > remote mail delivery system should attempt to send a bounce to -- and if at > our end we have a script (procmail in my case, but any number of scripting > languages could be used) to handle incoming messages at the address(es), > then bounce handling can be automated, and as long as the bounce is > actually to the coded address in the Return-Path, the system can take > measures to either suspend the account (say, after five or some other > threshold of bounces) or automatically remove it (in high volume > applications, where a deadbeat user is invariably a problem). > > Please tell me that the Return-Path can be overriden in PHP -- because it > is trivial to override it in procmail, but I shouldn't need to relay it > through my own server just to change the header. > --- > Please DO NOT carbon me on list replies. I'll get my copy from the list. > > Sean B. Straw / Professional Software Engineering > Post Box 2395 / San Rafael, CA 94912-2395 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ----- Joe Stump, PHP Hacker joestump98@yahoo.com http://www.miester.org/ Need a programmer? http://www.google.com/search?q=%22Joe+Stump%22 ***************************************************************** * RENT THIS SPACE - SEEN BY THOUSANDS EACH DAY! * * Current Sponsor: http://www.smackdown.com * *****************************************************************

« previous php.general (#28700) next »