Hello. I am trying to get the ability to email from my web site through php. I downloaded the phpmailer program and followed the tutorial to the letter and I keep getting this error. Message was not sent.Mailer error: SMTP Error: Could not connect to SMTP host. I am just at a total loss.

My code is here:

<?php

 require("class.phpmailer.php");  

 $mail = new PHPMailer();  

 $mail->IsSMTP();  // telling the class to use SMTP  
$mail->Host = "smtpout.secureserver.net:110"; // SMTP server $mail-> Host = "pop.secureserver.net"; $mail->Username = "user@example.com"; $mail->Password = "pass";
$mail->From = "user@example.com";
$mail->AddAddress("testmail@yahoo.com"); $mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50; if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
} ?>
    1. You might not want to post your e-mail address and password for the world to see. I've removed these from your post, but make sure you don't post them in the future!

    2. As the error message states, PHP could not connect to the SMTP server. Verify that you have the correct host and that you can connect to it yourself. If you can, then the server PHP is running on might be behind a firewall that is set to deny connections to external SMTP hosts. If this is the case, you might want to contact your host and ask them how you should go about sending out e-mail.

      Yeah, thank you. I had planned to change it but got ahead of myself and forgot. That's why I marked it as resolved....I'm trying to figure out something else.

        Write a Reply...