Re: [NEWBIE] Mail Help
| From: | Michael Wallner | Date: | Mon, 21 Feb 2005 18:56:23 +0000 |
| Subject: | Re: [NEWBIE] Mail Help | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17600@lists.php.net to get a copy of this message | ||
Hi Brett Patterson, you wrote:
> Hello all. I am new to using PEAR, but not so much to PHP. I was looking
> for a little help.
Phew :) I'd suggest that you have a look at the PEAR manual first...
Here's a short example on how PEAR_Error might be used:
require_once 'PEAR.php';
require_once 'Mail.php';
$mail = &Mail::factory('mail', $params);
if (PEAR::isError($mail)) {
echo "Error: ", $mail->toString(), "\n";
// or
echo "Error: ", $mail->getMessage(), "\n";
}
funcion errorCb($e) {
echo "Error: ", $e->getMessage(), "\n";
}
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errorCb');
// effectivly the same as PEAR::setErrorHandling(PEAR_ERROR_PRINT);
if (PEAR::isError($mail->send($to, $hdrs, $body)) {
// no need to print the error once again,
// errorCb() will print the error
}
HTH,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc