VERP for Net_SMTP and Mail_smtp
| From: | Mika Tuupola | Date: | Thu, 22 Apr 2004 13:49:52 +0000 |
| Subject: | VERP for Net_SMTP and Mail_smtp | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-28262@lists.php.net to get a copy of this message | ||
Since I needed it I wrote a local modification for Net_SMTP
and Mail_smtp driver to allow VERP style deliveries.
The patches are pretty trivial and have been tested to work
with Postfix.
For Net_SMTP I also left room for future implementations
of other arguments such as SIZE or SECURITY for MAIL FROM:
command by passing the arguments in an array.
I dont know if these fit into your (Jon, Chuck) coding
style, but VERP support would be a nice addition to see.
-cut-
cvs diff SMTP.php
Index: SMTP.php
===================================================================
RCS file: /repository/pear/Net_SMTP/SMTP.php,v
retrieving revision 1.45
diff -r1.45 SMTP.php
661a662,666
> * @param array optional arguments. Currenly supported:
> * verp boolean or string. If true or string
> * verp is enabled. If string the characters
> * are considered verp separators.
> *
667c672
< function mailFrom($sender)
---
> function mailFrom($sender, $args=array())
669c674,688
< if (PEAR::isError($error = $this->_put('MAIL',
"FROM:<$sender>"))) {
---
>
> $argstr = '';
>
> if (isset($args['verp'])) {
> /* XVERP */
> if ($args['verp'] === true) {
> $argstr .=' XVERP';
>
> /* XVERP=something */
> } else if (trim($args['verp'])){
> $argstr .=' XVERP=' . $args['verp'];
> }
> }
>
> if (PEAR::isError($error = $this->_put('MAIL',
> "FROM:<$sender>$argstr"))) {
-cut-
-cut-
>cvs diff smtp.php
Index: smtp.php
===================================================================
RCS file: /repository/pear/Mail/Mail/smtp.php,v
retrieving revision 1.13
diff -r1.13 smtp.php
74a75,81
> * Whether to use VERP or not. If not boolean, string will be
> * used as VERP separators.
> * @var mixed boolean or string
> */
> var $verp = false;
>
> /**
84a92
> * verp Whether to use VERP or not. Defaults to false.
100a109
> if (isset($params['verp'])) $this->verp = $params['verp'];
164c173,176
< if (PEAR::isError($smtp->mailFrom($from))) {
---
> /* controls whether to use VERP or not */
> $args['verp'] = $this->verp;
>
> if (PEAR::isError($smtp->mailFrom($from, $args))) {
-cut-
--
Mika Tuupola http://www.appelsiini.net/~tuupola/