0

My website is hosted on godaddy, and I just figured out that my website is no more sending emails through phpmailer since last few months. I uploaded the latest version of phpmailer but still no success. The online web mail of my website runs fine. If I use php's "mail" function, it does send emails to gmail, but not to yahoo accounts.

I tried all the three ports 25, 465, and 587, but no luck

I am getting the following error from phpmailer:

SERVER -> CLIENT: 554 p3plsmtpa07-10.prod.phx3.secureserver.net ESMTP No Relay Access Allowed From 50.63.196.51
CLIENT -> SERVER: EHLO lostandfound.pakproject.com
SERVER -> CLIENT: 
SMTP ERROR: EHLO command failed: 
SMTP NOTICE: EOF caught while checking if connected
SMTP Error: Could not authenticate.
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Following is my code that I am trying to test. (User name, passwords, emails are changed...)

<?php

date_default_timezone_set('Etc/UTC');    
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';    
$mail->Host = "smtpout.... my_server";    
$mail->Port = 25;    
$mail->SMTPAuth = true;    
$mail->Username = "here_i_used_my_website_email"; 

$mail->Password = "here_password";    
$mail->setFrom('website_email', 'From name');   
$mail->addReplyTo('website_email', 'From name');    
$mail->addAddress('another_email', 'name_used_here'); 

$mail->Subject = 'About the task';    
$mail->Body = 'This is email body';    
$mail->AltBody = 'This is a plain-text message body';

if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}
?>
2
  • 1
    Godaddy blocks outbound SMTP. If you look at the connection response, it's not the same hostname as you asked to connect to - they are diverting you, so your login will not work. I suggest you open a support ticket with them.
    – Synchro
    Oct 6, 2015 at 21:21
  • 1
    Your mail server also configured on same machine/host? If so, look at stackoverflow.com/questions/32667927/… Oct 7, 2015 at 18:51

2 Answers 2

1
    $mail->SMTPSecure = false; 
    $mail->SMTPAuth = false;

It worked for me. Keep in mind https://co.godaddy.com/help/mail-server-addresses-and-ports-for-business-email-24071**

0

I was able to resolve my issue with the following code/settings of phpmailer

<?php


$recipient = "abc@def.com"
$subject = "Subject here";
$emailBody = "This is body";


// PHP MAILER CODE STARTS FROM HERE //
require '../phpmailermaster/PHPMailerAutoload.php';
$mail = new PHPMailer;

//$mail->SMTPDebug = 3;    // Enable verbose debug output

$mail->isSMTP();       // Set mailer to use SMTP
$mail->Host = 'smtpout.secureserver.net'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'xxx@yyyy.com'; // SMTP username
$mail->Password = '3344123';  // SMTP password

//$mail->SMTPSecure = 'ssl';    // Enable TLS encryption, `ssl` also accepted
//$mail->Port = 465;

$mail->Port = 80;   // TCP port to connect to [THIS PORT ALLOWING EMAILS]
$mail->setFrom('xxx@yyyy.com', 'hello');

//$mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient

$mail->addAddress($recipient);                 // Name is optional

//$mail->addReplyTo('info@example.com', 'Information');

//$mail->addBCC('bcc@example.com');
//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
//$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = $subject;
$mail->Body    = $emailBody;
$mail->AltBody = $emailBody;

if(!$mail->send()) 
{
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} 
else 
{
    echo 'Message has been sent';       
}

// PHP MAILER CODE ENDS HERE ==


?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.