cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

Can't Get GoDaddy Hosting and PHPMailer to work

Hello All, I am currently having an issue with my Website, as it will not send any emails to people who sign up, The code is on a separate website bacuse it will not allow me to post it in its entiraty here. Hopefully, someone knows what I'm doing wrong.

 

Link: https://stackoverflow.com/questions/45474978/sending-emails-using-godaddy-hosting-with-phpmailer/454...

 

The Error I receive is as follows:

Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting.

 

Note: new to the Coding Industry as well as Email Serverside type stuff, so sorry if I made a fundamental mistake 🙂

 

Regards

Joshua Micallef

1 ACCEPTED SOLUTION
Advocate I

I think the ultimate problem here is GoDaddy's failure to keep their CPanel screens and documentation consistent with ongoing changes in their hosting networks.  The following settings worked for me. Note three important settings:

  1. The SMTP host must be the GoDaddy server host name not  a derivative of your domain name as reported by the Configure Email Client screen. The SSL certificate for the SMTP servers still uses GoDaddy's secureserver.net domain, so you have to use a host on that domain to pass the server SSL security check.  The Configure Email Client screen used to display the GoDaddy host, but it's part of every CPanel link URL. Just copy it from your browser address bar when you're in CPanel. In the example below, you want the part in red. Don't use the host name in the example because your host may be different!
    https://a2plcpnl0426.prod.iad2.secureserver.net:2083/cpsess9928686537/frontend/gl_paper_lantern/index.html
  2. Even with the correct host name, the ssl encryption setting (with port 465)  will not work. You must set $mail->SMTPSecure to tls.
  3. With TLS port 587 must be used.

$mail->isSMTP(); 
$mail->Host = 'a2plcpnl0426.prod.iad2.secureserver.net';    // Must be GoDaddy host name
$mail->SMTPAuth = true; 
$mail->Username = 'guy@mydomain.com';
$mail->Password = 'guyPassword';
$mail->SMTPSecure = 'tls';   // ssl will no longer work on GoDaddy CPanel SMTP
$mail->Port = 587;    // Must use port 587 with TLS

 

I hope this helps someone.

View solution in original post

24 REPLIES 24
Community Manager

Hi @JoshuaMicallef. Thanks for being part of GoDaddy Community! The following PHP settings should help you begin to send emails. Our SMTP server doesn't currently support SSL, so you won't be able to use the port you're trying to use. You'll also have to specify a different host:

$mail->Host       = "relay-hosting.secureserver.net";
$mail->Port       = 25;                   
$mail->SMTPDebug  = 0;
$mail->SMTPSecure = "none";                 
$mail->SMTPAuth   = false;
$mail->Username   = "";
$mail->Password   = "";

Hope that helps! 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.

Hey @JesseW, Saddly even after changing my code to match yours, aswell as changing my host and imputing my Username/Password, it has still failed to connect with the error. 

 

Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

 

Im not sure what is going wrong. This is what i put in.

 

$mail->Host = "mail.ozzietransport.org";
$mail->Port = 25;
$mail->SMTPDebug = 0;
$mail->SMTPSecure = "none";
$mail->SMTPAuth = false;
$mail->Username = "myemail";
$mail->Password = "mypassword";

@JoshuaMicallef One of the most important parts of the connection is what is entered for the host. If you're sending email from any of our shared hosting servers, the server you must use is  relay-hosting.secureserver.net. You won't be able to send using any other mail server. Also, there's no need to enter a username or password in this situation. Feel free to give that a try. 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.

Hi, 

Thanks for your help.

 

I have configured the same way you show here. The funny things is that it works from my local machine, but once I try to run it from the server the mail does not get anywhere. Is there some kind of configuration I am missing on the server side? I was reading something about MX records. Please help me, I can't use chat as it seems to be disabled all the time, and in my country you don't have a free line so is becoming a real pain to try to contact your support team.

 

Thanks!

Hello @maledr5

 

What is the code you are using for your mailer, im managed to fix this issue a while ago, so hopefully i can help you.

I have done what was suggested but am still having this error:

SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Hello JesseW,

 

In my case, the emails are hosted on Google and when I try sending an email using PHPMail and SendMail, there is no error but I end up not getting the emails. When I use SMTP, it throws an error. I use port 25, no ssl/tls, host is smtp.gmail.com and no SMTPAuth. Kindly assist as this is holding me back from launching my service to clients. 

Advocate I

I think the ultimate problem here is GoDaddy's failure to keep their CPanel screens and documentation consistent with ongoing changes in their hosting networks.  The following settings worked for me. Note three important settings:

  1. The SMTP host must be the GoDaddy server host name not  a derivative of your domain name as reported by the Configure Email Client screen. The SSL certificate for the SMTP servers still uses GoDaddy's secureserver.net domain, so you have to use a host on that domain to pass the server SSL security check.  The Configure Email Client screen used to display the GoDaddy host, but it's part of every CPanel link URL. Just copy it from your browser address bar when you're in CPanel. In the example below, you want the part in red. Don't use the host name in the example because your host may be different!
    https://a2plcpnl0426.prod.iad2.secureserver.net:2083/cpsess9928686537/frontend/gl_paper_lantern/index.html
  2. Even with the correct host name, the ssl encryption setting (with port 465)  will not work. You must set $mail->SMTPSecure to tls.
  3. With TLS port 587 must be used.

$mail->isSMTP(); 
$mail->Host = 'a2plcpnl0426.prod.iad2.secureserver.net';    // Must be GoDaddy host name
$mail->SMTPAuth = true; 
$mail->Username = 'guy@mydomain.com';
$mail->Password = 'guyPassword';
$mail->SMTPSecure = 'tls';   // ssl will no longer work on GoDaddy CPanel SMTP
$mail->Port = 587;    // Must use port 587 with TLS

 

I hope this helps someone.

View solution in original post

thank you, thank you, thank you!

I specifically registered just to say thank you for taking the time out and putting all the NEEDED correct information!! you are the man!!

 

Smiley Happy

 

😉

I'm glad it helped!

I've been searching for a solution to this issue for about a week now, with so many different methods and opinions online about it, it's been quite difficult to find something that actually works. But after reading this post and its solution I've finally got it to work. Thanks so much @D2M2Tech, it works a treat!

 

 

<?php
require_once '/home/*********/public_html/setup/config/PHPMailer/PHPMailerAutoload.php';

$mail = new PHPMailer;
$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = '*********.prod.sin2.secureserver.net';
$mail->SMTPAuth = true;
$mail->Username = '*********'; // This was my GoDaddy cPanel username
$mail->Password = '*********'; // And my GoDaddy cPanel password
$mail->SMTPSecure = 'tls';
$mail->Port = 587;

$mail->setFrom('email@example.com.', 'My Name');
$mail->addAddress('recipient@email.com'); // Add a recipient, Name is optional
$mail->addAddress('another_recipient@email.com');
$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.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}

?>

I am still getting no emails with above settings 
My Exchange server is hosted in-house so not using GoDaddy emails

 

$mail->Host = '*********.prod.ams3.secureserver.net';  //This is my cPanel link till secureserver.net
$mail->SMTPAuth = true;
$mail->Username = '*********'; // This was my GoDaddy cPanel username
$mail->Password = '*********'; // And my GoDaddy cPanel password
$mail->SMTPSecure = 'tls';
$mail->Port = 587;

I get this error in log file

[15-Mar-2018 17:41:06 UTC] PHP Warning:  stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /home/*********/public_html/*******/wp-includes/class-smtp.php on line 369

 

hussainsheikh, if you are not using CPanel email hosted on GoDaddy servers, this solution does not apply to you.  I would add, however, you should be using an SMTP host, user name, and password configured on your Exchange server.  You should not, in any case, use your CPanel user name and password.

 

If you continue to receive the error after correcting your settings, follow the link below for detailed information about the problem and its solution.

'SMTP connect() failed' error on localhost #368

@D2M2Tech created an Email account on cPanel and used your settings but still not getting any emails.

You say that you are still not getting any emails. Are you attempting to receive email messages somehow?  PHPMailer is for sending email messages.  Please describe exactly what you are trying to do.

@D2M2Tech Obviously we all are here as we know what PHPMailer is used for.  What i meant by "not getting any emails" means in simple English that "used your solution to this fix by creating email account on cpanel and used your suggested settings but still not getting any emails via contact form of the website" 

@hussainsheikh  Sorry.  The way you phrased the statement prompted the question.  Try turning on debugging by setting the following

$mail->SMTPDebug=2;
$mail->Debugoutput='error_log';

You can get detailed information about debugging PHPMailer by following the link below.

Debugging PHPMailer

@D2M2Tech sorry mate, still not getting anywhere and getting the same error message. 

 

[15-Mar-2018 20:24:10 UTC] PHP Warning:  stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /home/xxxxxxxxx/public_html/xxxxxxxx/wp-includes/class-smtp.php on line 369

@hussainsheikh  I see you've also communicated with the PHPMailer developer about this issue over the last week.  You must be getting quite frustrated at this point.  I'd like to help you.  Let's move this conversation to messaging so you can share more specific information.  I'll setup one of my client's sites to test and verify the settings then we can begin.

@D2M2Tech where you intend to message me?