 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
saran_php
Joined: 09 May 2007 Posts: 2
|
Posted: Wed May 09, 2007 9:56 pm Post subject: Pear mail - "Unable to authenticate to smtp server" |
|
|
Hi ,
I am trying to send mail using PEAR mail functionality.
I have used the following code snippet to send mails. But, when I execute the code I am getting "unable to authenticate to smtp server". I need this solved urgently. If any of you people give me your suggestions, it would be great !!!!!!!!.
<?php
require_once "Mail.php";
$from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?> |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1003
|
Posted: Thu May 10, 2007 11:44 am Post subject: Re: Pear mail - "Unable to authenticate to smtp server& |
|
|
| saran_php wrote: | Hi ,
I am trying to send mail using PEAR mail functionality.
I have used the following code snippet to send mails. But, when I execute the code I am getting "unable to authenticate to smtp server". I need this solved urgently. If any of you people give me your suggestions, it would be great !!!!!!!!. |
Have you checked that server, username and password are correct? |
|
| Back to top |
|
 |
saran_php
Joined: 09 May 2007 Posts: 2
|
Posted: Thu May 10, 2007 2:46 pm Post subject: |
|
|
| Yes, i have checked the credentials. They are the same. |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1003
|
Posted: Thu May 10, 2007 3:48 pm Post subject: |
|
|
Where does this "unable to authenticate to smtp server" come from? I can't find it in the code.
Please make also sure that you have the latest version of Mail and Net_SMTP installed. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|