PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Pear mail - "Unable to authenticate to smtp server"

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
saran_php



Joined: 09 May 2007
Posts: 2

PostPosted: Wed May 09, 2007 9:56 pm    Post subject: Pear mail - "Unable to authenticate to smtp server" Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1003

PostPosted: Thu May 10, 2007 11:44 am    Post subject: Re: Pear mail - "Unable to authenticate to smtp server& Reply with quote

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
View user's profile Send private message
saran_php



Joined: 09 May 2007
Posts: 2

PostPosted: Thu May 10, 2007 2:46 pm    Post subject: Reply with quote

Yes, i have checked the credentials. They are the same.
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1003

PostPosted: Thu May 10, 2007 3:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software