tags:

views:

528

answers:

3

I tried to use php mailer but errors as follows.

SMTP -> FROM SERVER:
SMTP -> FROM SERVER:
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> FROM SERVER:
SMTP -> ERROR: HELO not accepted from server:
SMTP -> ERROR: AUTH not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connectedSMTP Error: Could not authenticate. Message could not be sent.

Mailer Error: SMTP Error: Could not authenticate. 

and my code

 <?php
        require("class.phpmailer.php")
        $mail = new PHPMailer();        
        $mail->IsSMTP();                                    
        $mail->Host = "smtp.gmail.com";  
        $mail->Port = 465;        
        $mail->SMTPAuth = true;     

        $mail->SMTPDebug = 2;  
        $mail->Username = "[email protected]";  
        $mail->Password = "xxxxxxxx";   
        $mail->From = "[email protected]";
        $mail->FromName = "Mailer";
        $mail->AddAddress("[email protected]", "mine");               
        $mail->WordWrap = 50;                                 
        $mail->IsHTML(true);                                  

        $mail->Subject = "Here is the subject"  
        $mail->Body    = "This is the HTML message body <b>in bold!</b>";
        $mail->AltBody = "This is the body in plain text for non-HTML mail clients";


        if(!$mail->Send())  {
           echo "Message could not be sent. <p>";
           echo "Mailer Error: " . $mail->ErrorInfo;
           exit;
        }
        echo "Message has been sent";

        ?>
+1  A: 

not sure but try $mail->Host = "smtp.gmail.com" =>$mail->Host = "smtp.google.com"

SpawnCxy
smtp.gmail.com is correct.
Shoban
oh i am sorry:)
SpawnCxy
+1  A: 

May be because of fire wall?

If you can't sign in to Google Talk, or you're receiving an error that says, Could not authenticate to server, check if you have personal firewall software installed, or if your computer is behind a proxy server that requires a username and password.

http://www.google.com/support/talk/bin/answer.py?hl=en&amp;answer=30998

Shoban
+1  A: 

Some servers (especially shared hosting) will block you from using SSL with SMTP, I had the same problem once.

Either change host if you can, try using the default PHP mail() function or send through another mail server that does not require SSL e.g. port 25 not 465.

Something like AuthSMTP would be your best bet for an alternate mail server.

fire