Re: Pear Mail() problem
| From: | Scott Harman | Date: | Sun, 05 Sep 2004 09:02:08 +0000 |
| Subject: | Re: Pear Mail() problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14417@lists.php.net to get a copy of this message | ||
Add pear::iserror code as follows: this is a function to e-mail a user's
password to them -
this way you'll actually be able to see your errors! :)
Everything you do with pear - test for an error.
certain bits either return false or an object etc.
function userPwdMail($email, $passwd)
{
$params = array("host" => MAIL_HOST,
"auth" => MAIL_AUTH,
"username" => MAIL_USER,
"password" => MAIL_PASS
);
$mail = &Mail::factory("smtp", $params);
if (PEAR::isError($mail)) {
echo($mail->getMessage());
}
$to = $email;
$msg = ("Thank you for registering for access.\n"
. "Your new password details are as follows:\nPassword: "
. $passwd
. "\n\nYou may now login.\n"
);
$headers = array('Subject' => "Password Details",
'From' => "administrator",
'To' => $to,
'Date' => date('r'),
'Content-Type' => 'text/plain',
'X-Mailer' => "PHP/" . phpversion()
);
$result = $mail->send($to, $headers, $msg);
if (PEAR::isError($result)) {
echo($result->getMessage());
}
}
"Stowe Spivey" <spiveyspivey@yahoo.com> wrote in message
news:20040904205246.16648.qmail@web40102.mail.yahoo.com...
> Also, My Mail.php has the following properties:
>
> Mail.php 7,287 10/22/02 rw-r--r--
>
> Thanks for any guidance for troubleshooting this!
>
>
>
> __________________________________
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
> http://mobile.yahoo.com/maildemo