Pear::Mail_smtp

From: Date: Wed, 28 Jul 2004 10:27:30 +0000
Subject: Pear::Mail_smtp
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13892@lists.php.net to get a copy of this message
Hi, i'm currently using Pear::Mail with smtp driver for a project. i would like to suggest adding a little feature to the smtp driver. a debug param passed to Mail::Factory which would be used by the smtp driver for debugging purpose. $params['debug'] = 0/1 i think it would be cool if we could use the debug feature of Net::SMTP at dev time when used by Mail::Smtp here is a small proposed patch Regards xavier
--- smtp.php    2004-04-28 09:31:00.000000000 +0200
+++ smtp.php    2004-07-28 12:21:38.000000000 +0200
@@ -80,6 +80,12 @@
     var $verp = false;
     /**
+     * The debug flag, used if we want smtp to echo the sent message
+     * @var integer
+     */
+    var $debug = 0;
+
+    /**
      * Constructor.
      *
      * Instantiates a new Mail_smtp:: object based on the parameters
@@ -91,6 +97,7 @@
      *     password    The password to use for SMTP auth. No default.
      *     localhost   The local hostname / domain. Defaults to localhost.
      *     verp        Whether to use VERP or not. Defaults to false.
+     *     debug       The debug flag to activate SMTP debug mode. Defaults to 0.
      *
      * If a parameter is present in the $params array, it replaces the
      * default.
@@ -108,6 +115,7 @@
         if (isset($params['password'])) $this->password = $params['password'];
         if (isset($params['localhost'])) $this->localhost = $params['localhost'];
         if (isset($params['verp'])) $this->verp = $params['verp'];
+        if (isset($params['debug'])) $this->debug = intval($params['debug']);
     }
     /**
@@ -142,6 +150,10 @@
             return PEAR::raiseError('unable to instantiate Net_SMTP object');
         }
+        if (1 === $this->debug) {
+            $smtp->setDebug(true);
+        }
+
         if (PEAR::isError($smtp->connect())) {
             return PEAR::raiseError('unable to connect to smtp server ' .
                                     $this->host . ':' . $this->port);


« previous php.pear.general (#13892) next »