Fwd: Mail_smtp enhancement
| From: | Chuck Hagenbuch | Date: | Fri, 16 Aug 2002 18:10:56 +0000 |
| Subject: | Fwd: Mail_smtp enhancement | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-8462@lists.php.net to get a copy of this message | ||
Passing this on to the list so I don't piss off anyone by going and
changing the Mail package. Sounds like a good idea to me.
----- Forwarded message from cadams@salk.edu -----
Date: Thu, 15 Aug 2002 21:38:34 -0700
From: Chris Adams <cadams@salk.edu>
Reply-To: Chris Adams <cadams@salk.edu>
Subject: Mail_smtp enhancement
To: chuck@horde.org
I recently needed to set the Return-Path header for automatic bounce
handling. I modified the existing Mail_smtp to look for a Return-Path
header and use that instead of the From header in the smtp MAIL FROM
exchange.
I've attached a diff against the stock smtp.php.
Chris
/usr/share/pear/Mail $ diff -urN smtp.php smtp2.php
--- smtp.php Sun Mar 31 16:58:48 2002
+++ smtp2.php Thu Aug 15 20:20:37 2002
@@ -121,6 +121,14 @@
}
list($from, $text_headers) = $this->prepareHeaders($headers);
+
+ // Since few MTAs are going to allow this header to be forged
+ // unless it's in the MAIL FROM: exchange, we'll use Return-Path
+ // instead of From: if it's set
+ if (!empty($headers['Return-Path'])) {
+ $from = $headers['Return-Path'];
+ }
+
if (!isset($from)) {
return new PEAR_Error('No from address given');
}
----- End forwarded message -----
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"After a few minutes the most aromatic and nice smelling Italian coffee
will come out of the exhaustpipe." - Our stove-top espresso pot