cvs: php4 /pear/Mail smtp.php

From: Date: Tue, 06 Nov 2001 14:42:44 +0000
Subject: cvs: php4 /pear/Mail smtp.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1270@lists.php.net to get a copy of this message
chagenbu Tue Nov 6 09:42:44 2001 EDT Modified files: /php4/pear/Mail smtp.php Log: these should all be checking for PEAR::isError(), not ! ... Index: php4/pear/Mail/smtp.php diff -u php4/pear/Mail/smtp.php:1.7 php4/pear/Mail/smtp.php:1.8 --- php4/pear/Mail/smtp.php:1.7 Fri Aug 17 17:39:44 2001 +++ php4/pear/Mail/smtp.php Tue Nov 6 09:42:44 2001 @@ -23,7 +23,7 @@ * Net_SMTP:: class. * @access public * @package Mail - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ class Mail_smtp extends Mail { @@ -113,11 +113,11 @@ include_once 'Net/SMTP.php'; if (!($smtp = new Net_SMTP($this->host, $this->port))) { return new PEAR_Error('unable to instantiate Net_SMTP object'); } - if (!$smtp->connect()) { return new PEAR_Error('unable to connect to smtp server ' . $this->host . ':' . $this->port); } + if (PEAR::Error($smtp->connect())) { return new PEAR_Error('unable to connect to smtp server ' . $this->host . ':' . $this->port); } if ($this->auth) { - if (!$smtp->auth($this->username, $this->password)) { return new PEAR_Error('unable to authenticate to smtp server'); } - if (!$smtp->identifySender()) { return new PEAR_Error('unable to identify smtp server'); } + if (PEAR::isError($smtp->auth($this->username, $this->password))) { return new PEAR_Error('unable to authenticate to smtp server'); } + if (PEAR::isError($smtp->identifySender())) { return new PEAR_Error('unable to identify smtp server'); } } list($from, $text_headers) = $this->prepareHeaders($headers); @@ -125,14 +125,14 @@ return new PEAR_Error('No from address given'); } - if (!($smtp->mailFrom($from))) { return new PEAR_Error('unable to set sender to [' . $from . ']'); } + if (PEAR::isError($smtp->mailFrom($from))) { return new PEAR_Error('unable to set sender to [' . $from . ']'); } $recipients = $this->parseRecipients($recipients); foreach($recipients as $recipient) { if (PEAR::isError($res = $smtp->rcptTo($recipient))) { return new PEAR_Error('unable to add recipient [' . $recipient . ']: ' . $res->getMessage()); } } - if (!$smtp->data($text_headers . "\n" . $body)) { return new PEAR_Error('unable to send data'); } + if (PEAR::isError($smtp->data($text_headers . "\n" . $body))) { return new PEAR_Error('unable to send data'); } $smtp->disconnect(); return true;

« previous php.pear.cvs (#1270) next »