PHPmailer Godaddy Server Smtp Connection Refused

PHPMailer GoDaddy Server SMTP Connection Refused

As it seems this is a continuing problem, let me add my own experience.

Our website uses PHPMailer and the site is hosted on a GoDaddy linux server. The settings that seemed to be correct (according to everything I could find on SO and the goDaddy support site) were as follows:

SMTP_SERVER: smtpout.secureserver.net (or alternatively relay-hosting.secureserver.net)
SMTP_PORT: 465 //or 3535 or 80 or 25
SMTP_AUTH: true //always
SMTP_Secure: 'ssl' //only if using port 465

After spending 6+ hours trying every variation of ports(25, 3535, 4655), servers relay-hosting.secureserver.net,smtpout.secureserver.net:[port], etc.), usernames, passwords,etc. I called goDaddy. Another 40 minutes later, it was revealed that:

1) the "workspace" email accounts are being retired. That's important because if you have an email account with goDaddy today, you likely have a Workspace account. This is, according to the tech support rep, hosted separately from you linux account.

2) goDaddy is moving toward cPanel email accounts. Hurray! Time table? "...in the next 2 to 3 years!"

3) I moved our accounts from Workspace to cPanel accounts while I was on the phone with the rep. Really easy to do.

4) After you change your email accounts (including editing your MX records) to a cPanel email (vs. a "workspace" email) the appropriate settings for a web-form email using PHPMailer are:

SMTP_SERVER: localhost   //(and I mean literally: "localhost"- in place of smtp.secureserver.net and relay-hosting.secureserver.net, etc.)

... and everything else (as above) the same...

The webform I built with PHPMailer worked perfectly after this change!

Use your cPaneL email account login (username) and password in the PHPMailer setup and your web emails will work seamlessly!

An added bonus is that webmail (does anybody use this anymore?) can be accessed at [yourdoman]\webmail. No more cryptic url's to remember! And the accounts cand be IMAP or POP!

Admittedly, this means you must use goDaddy's cPanel email accounts, but getting the webform to work flawslessly with PHPMailer was the real reward!

PHPMailer & GoDaddy

Well, i have contacted the goDaddy support(very good), they said to use localhost when inside their servers, so i changed my code, still didnt work, but at least connected to the server and gave me the error: STARTTLS, searching in the web i found this solution: solution

$mail = new PHPMailer(true);
$mail->IsSMTP(); // Using SMTP.
$mail->SMTPDebug = 1;
$mail->SMTPAuth = false; // Enables SMTP authentication.
$mail->Host = "localhost"; // GoDaddy support said to use localhost
$mail->Port = 25;
$mail->SMTPSecure = 'none';

//havent read yet, but this made it work just fine
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);

$mail->AddReplyTo('comercial@email.com.br', 'Me');
$mail->AddAddress('my@gmail.com', 'Them');
$mail->SetFrom('comercial@email.com.br', 'Me');
$mail->Subject = 'PHPMailer Test Subject via smtp, basic with authentication';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->MsgHTML("Hi, this is an test email");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}

To finilize, they also gave me this script: Github to test the email sending in three diff ways, but the emails this script send may go to your spam(the first script goes normal), so they said that is necessary to configure something with the TXT records and DNS, this is the data the support gave me:

Add TXT record

Host:@

TXT value :v=spf1 a mx ptr include:secureserver.net -all

TTL: 1 hour

But i dont know for sure about this, unffotunatelly, i couldnt stay for this solution as i had to go to the doctor, thanks all for att.



Related Topics



Leave a reply



Submit