Re: Re: [NEWBIE] Mail Help
| From: | Matthew Weier O'Phinney | Date: | Mon, 21 Feb 2005 20:08:56 +0000 |
| Subject: | Re: Re: [NEWBIE] Mail Help | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17604@lists.php.net to get a copy of this message | ||
* Brett Patterson <brett2@umbc.edu>:
> Okay, so below is the code I'm using. I modified it to be
> if(PEAR::isError($mail)){ but that still returns a false positive. For some
> odd reason, it won't send the email and will NOT show an error. Any ideas?
>
>
> $mail = &Mail::factory($method, $params);
> $mail->send($recips, $headers, $message);
> if(PEAR::isError($mail)){
> $error = $mail->toString();
> $error2 = $mail->getMessage();
You need to test the RETURN VALUE of the send() method -- which, at this
point, you're not capturing. Additionally the object instance ($mail)
does not contain the error -- it is a Mail object; the RETURN VALUE
contains the error, if any. Try:
$sent = $mail->send($recips, $headers, $message);
if (PEAR::isError($sent)) {
$error = $sent->toString();
$error2 = $sent->getMessage();
You should get much better results at this point.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org