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

24 REPLIES 24
Community Manager
Community Manager

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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.

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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";

Community Manager
Community Manager

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@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.

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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!

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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.

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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

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

New

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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
Solution

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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.

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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

 

😉

Advocate I

Re: Can't Get GoDaddy Hosting and PHPMailer to work

I'm glad it helped!

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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';
}

?>

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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

 

Advocate I

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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

Advocate I

Re: Can't Get GoDaddy Hosting and PHPMailer to work

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.

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@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" 

Advocate I

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@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

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@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
Advocate I

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@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.

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@D2M2Tech where you intend to message me?

Re: Can't Get GoDaddy Hosting and PHPMailer to work

Hi @D2M2Tech & @hussainsheikh. Any update regarding that issue. I'm facing the same issue here. Even i tried logging with "$mail->SMTPDebug = 2;". Everything works fine and the PHPMailer logs looks neat. But still the mail is not getting delivered. Any clue?

 

My configuration:

$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 587; // set the SMTP server port
$mail->Host = "sg3plcpnl0046.prod.sin3.secureserver.net"; // SMTP server
$mail->Username = "some@mail.com"; // SMTP server username
$mail->Password = "password"; // SMTP server password
$mail->SMTPSecure = 'tls';

Advocate I

Re: Can't Get GoDaddy Hosting and PHPMailer to work

I began a private message session with @hussainsheikh to help them find a solution without polluting the thread with unhelpful messages.  They stopped communicating, but I did share the following  finding with them.

 

I setup a test and was able to successfully send using both TLS and SSL settings.  Despite previous failures, these settings worked for me:

$phpmailer->isSMTP();     
$phpmailer->Host = 'a2plcpnl0105.prod.iad2.secureserver.net';
$phpmailer->SMTPAuth = true;
$phpmailer->SMTPSecure = "ssl";
$phpmailer->Port = 465;
$phpmailer->Username = 'user@somedomain.com';
$phpmailer->Password = 'password';
// I was also able to send successfully with SMTPSecure to "tls" and Port to 587

There may be something peculiar about your host (sg3plcpnl0046.prod.sin3.secureserver.net), but if your log file indicates the send was successful, it probably was. Check your spam folder.  If you do not find your email message there, I would be happy to examine your log file for any clues you may have missed. Let's keep the thread concise; click on my user name and send the log via private message.  We can share any success or useful findings here.

Advocate I

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@accmadura  I've posted two replies, but both disappeared, apparently marked as spam.  Since I have no idea which part was flagged, I'll attempt a briefer response. @hussainsheikh stopped responding during our private messaging session, so I don't know if they found a resolution.

 

I ran a test and discovered that both SSL and TLS settings work on my host now despite previous failures of SSL.  You can try setting SMTPSecure to "ssl" and Port to 465 to see if that is a solution. If your log indicates the transmission was successful, it probably was. There may be something peculiar about your host (sg3plcpnl0046.prod.sin3.secureserver.net).

  1. Check your spam folder
  2. Try SSL
  3. I would be happy to examine your log file for any clues you may have missed. Click on my user name and send it via private message.
  4. If nothing else works, perhaps it is the host and GoDaddy's support team might be able to move your account to a different one.

Re: Can't Get GoDaddy Hosting and PHPMailer to work

@D2M2Tech - This has been tremendously helpful. Thank you.