Mail() breakthrough - but now getting "unable to authenticate to smtp server"
| From: | Stowe Spivey | Date: | Mon, 06 Sep 2004 14:31:39 +0000 |
| Subject: | Mail() breakthrough - but now getting "unable to authenticate to smtp server" | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14431@lists.php.net to get a copy of this message | ||
Here's what the page displays:
===============================
1
2
unable to authenticate to smtp server
3
pear_error Object ( [error_message_prefix] => [mode] => 1 [level] =>
1024 [code] => [message] => unable to authenticate to smtp server
[userinfo] => [backtrace] => [callback] => )
===============================
Below is the code that generated this above display. It is a real
account:
===============================
ini_set("include_path", "/path/to/pear/")."<BR>";
require("Mail.php");
$recipients = "me@yahoo.com";
$headers["From"] = "smtp_account_on_my_smtpserver@mydomain.com";
$headers["To"] = "me@yahoo.com";
$headers["Subject"] = "Test message";
$body = "Test message";
$params["host"] = "smtpserver.mydomain.com";
$params["port"] = "25";
$params["auth"] = "True";
$params["username"] = "smtp_account_on_my_smtpserver";
$params["password"] = "password";
echo "1<BR>";
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('smtp', $params);
if (PEAR::isError($mail_object)) {
echo($mail_object->getMessage());
}
echo "2<BR>";
$result = $mail_object->send($recipients, $headers, $body);
if (PEAR::isError($result)) {
echo($result->getMessage());
}
echo "<BR>3<BR>";
print_r($result);
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail