Mail class error handling

From: Date: Thu, 15 Apr 2004 18:56:40 +0000
Subject: Mail class error handling
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11873@lists.php.net to get a copy of this message
I'm perplexed why I do not get any error message from the PEAR Mail class, even when I intentionally try to break it. For instance, below, if I change the SMTP password to an incorrect value, no error message is returned, and no message gets sent. If I set it correctly, an email gets sent. Any insight would be appreciated. $crlf = "\r\n"; $hdrs = array(
	'From'    => 'me@example.com',
'Subject' => 'My test subject', 'Reply-To' => 'me@example.com' ); $smtparray = array( 'host' => 'mail.example.com', 'auth' => TRUE, 'username' => 'example@example.com', 'password' => 'mailpass' ); $mime = new Mail_mime($crlf); $mime->setTXTBody($plaintextmessage); $mime->setHTMLBody($htmlmessage); $body = $mime->get(); $hdrs = $mime->headers($hdrs); $mailObj =& Mail::factory('smtp',$smtparray); $mailObj->send($to, $hdrs, $body); if (PEAR::isError($mailObj)) { return $mailObj -> getMessage(); } else { return "E-mail successfully sent." }

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