Hi,

I can't send authenticated email from phpmailer. Code and error are shown below. If SMTPAuth is false then mail goes only to my mail. Everyting under C:\wamp\www\phpMailer. I didn't do any changes in "class.phpmailer.php" file.
Thanks

Error: "Mailer Error: SMTP Error: Could not connect to SMTP host."

Code:

<?php
require("class.phpmailer.php");
 
$mail = new PHPMailer();
 
$mail->IsSMTP();                  
$mail->Host = "mail.myhost.com";  
$mail->SMTPAuth = true;     
$mail->Username = "myusername"; 
$mail->Password = "mypasw"; 
$mail->From = "mail@mymail.com";
$mail->FromName = "Name";
$mail->AddAddress("mail@mymail.com", "Name");
 
 
$mail->WordWrap = 50;       
$mail->IsHTML(true);        
 
$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
 
if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}
?>

solved with different smtp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.