I have been using the mail() funcion to send emails to clinets. However now there is a need to be able to send email with attachments to the clients. So I shifted to phpmailer (http://www.phpmailer.sourceforge.net) to be able to send mail.

I need someone help here, I am trying to connect using SMTp untheticate ...but for some strange reason the authentication always fails. I have checked with my ISP and have found that evrything is fine at their end.

Here is the code:

<?php
require("class.phpmailer.php");
//require("class.smtp.php");

$mail = new phpmailer();

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.abs.adelphia.net";

$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "my_login"; // SMTP username
$mail->Password = "my_password"; // SMTP password

$mail->From = "someone@adelphia.net";
$mail->FromName = "Pushpinder Singh Garcha";
$mail->AddAddress("someone@hotmail.com");

//AddAttachment($path);

$mail->Subject = "This is a Test Mail";
$mail->Body = "hi ! \n\n I am really very very anxious to see if this works or not !";
$mail->WordWrap = 20;

if(!$mail->Send())
{
echo "Message was not sent\n\n";
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>

Please help me. This is the error that I keep getting.
"Message was not sent Mailer Error: SMTP Error: Could not authenticate "

Thanks
--Pushpinder Singh 🙂

    Make sure that you have the correct username ("my_login") and password ("my_password") to smtp.abs.adelphia.net

    $mail->SMTPAuth = true; // turn on SMTP authentication
    $mail->Username = "my_login"; // SMTP username
    $mail->Password = "my_password"; // SMTP password

      Hi Erik..

      I have checked with Adelphia.net and my Username and Password are correct.
      Infact I am able to receive Email using the same SMTP Server....only when it comes to this php script I get stumped

      Many thanks
      --pS

        Write a Reply...