SMTP email sending no longer working (using PHPMailer)

Asked by:
HubFans / n/a Points
Time:
2017-02-26 5:09 am EST
Category:
Send Email From A Page
Hits:
8
Up until recently i was able to send emails through the server with no issues at all. However now i am met with the error message: "SMTP ERROR: Failed to connect to server".

Reading up i can see that this can be caused if port 25 is being blocked, however i am already using port 465. Below are the settings that i am using.

Please help, this is causing me a major headache:
$smtp = new PHPMailer();
$smtp->IsSMTP();
$smtp->SMTPAuth = true;
$smtp->SMTPSecure = "ssl";
$smtp->Host = "localhost";
$smtp->Port = 465;
$smtp->Username = "donotreply@myemailsender.co.uk";
$smtp->Password = "correctemailpassword";
$smtp->SetFrom("donotreply@myemailsender.co.uk", "Friendly Name");
$smtp->AddAddress("receiver@theiremailserver.co.uk");
$smtp->WordWrap = 50;
$smtp->IsHTML(true);
$smtp->Subject = "My chosen subject";
$smtp->Body = "My email body";
$smtp->AltBody = "My email body";
$smtp->Send();

if(!$smtp->send()){
echo "email_failed Error=".$smtp->ErrorInfo;
echo "email_check"."failed"."email_check_end";
}else{
echo "email_sent_to_$to";
echo "email_check"."success"."email_check_end";
}

To ask this user for more information, please first login.

To submit an answer, please login.

ANSWERS

0

ScottM
Staff
16,266 Points
2017-02-27 3:51 pm EST
Hello,

Thank you for your question on proper SMTP settings for your mail form. We cannot provide account-specific information here, so we must speak generally. You want to find out what specific setting is causing the issue. With a server connection issue, it is one of four things (server, port, username, or password). You will want to test these settings by setting up an account on an email client such as ThunderBird, Outlook, MacMail or Opera. If it fails using the same settings you are using here, then there is an issue with one or more of them.

If you try these and it works on the email client, you will need to contact Live Support as the issue will be account or server related and need them to locate and correct the setting issue.

Kindest Regards,
Scott M

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.