Question

At first; Sorry for my bad english skills. I allready try to improve them.

Here is my Problem. I want to send some mails using phpmailer. But the mailer can't authentificate with every of my mail accounts. the funny thing is two days ago everything worked well.

At least i allready tried the script from the readme file and entered my email information but it still dont work.

I have no idea what to do now and hope that you may help me

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "smtp1.MyServer.de";  // specify main and backup server
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "mymail@example.com";  // SMTP username
$mail->Password = "mypass"; // SMTP password

$mail->From = "mymail@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("mymail2@example.com", "test");


$mail->WordWrap = 50;                                 // set word wrap to 50 characters

$mail->IsHTML(true);                                  // set email format to HTML

$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";
Was it helpful?

Solution

Add below lines and try:

$mail->SMTPSecure = "ssl"; 
$mail->Port = 465; 

or

$mail->SMTPSecure = "tls"; 
$mail->Port = 587; 

Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top