Note: Godaddy also restricts using any free domains like gmail, yahoo, hotmail, outlook, live, aim or msn as sender domain/From address. For that, just make the following changes in your PHPMailer code and you will be done $mail->isSMTP() In case you are sending 1-1 personalized emails, then using Godaddy SMTP makes sense. Here are few workarounds to avoid SMTP connection issues in Godaddy: #1- Use Godaddy SMTP Instead Of Any Third Party: Your PHPmailer code might work perfectly fine on a local machine but the same code, when deployed on Godaddy server might not work and that's all because of this silly rule implemented by Godaddy. Godaddy primarily wants their users to use their own SMTP instead of any third party SMTP, which is not at all an acceptable move for the developer community and many have has expressed their frustration in form of issues on StackOverflow too. Then nothing to really debug further, because it is because of a wried rule imposed by Godaddy on its user, where Godaddy has explicitly blocked the outgoing SMTP connection to ports 25, 587 and 465 to all external servers except for their own. If you are running your code on Godaddy and trying to connect to some third-party SMTP provider like or and getting some errors like this Mailer Error: SMTP connect() failed. ![]() Possible Problem 2: Using Godaddy As The Hosting Provider This solution should work fine with PHPMailer v5.2.10 and higher. You can also change these settings globally, in the php.ini file but that's a really bad idea because PHP has done these SSL level strictness for very good reasons only. Here is a help doc on PHPMailer wiki which has a section around this.Īnd, here is the quick workaround mentioned in the above wiki, which will help you fix this problem: $mail->SMTPOptions = array( I noticed that in the newer version, PHP has implemented stricter SSL behaviour which has caused this problem. Later, I observed that this problem is there with the latest version of the PHP. But, when I updated the PHP version to 5.6, I started getting an SMTP connection error. I tried using PHPMailer in many projects in the past and it worked buttery smooth. Possible Problem 1: Problem With The Latest Version Of PHP So, please try to go through the different scenarios below and pick the one which is closest to your use case. ![]() ![]() In this document, I have tried sharing the answer for some of the most occurring errors with the PHPMailer: #Error: PHPMailer: SMTP Error: Could Not Connect To SMTP Hostĭepending on your situation, there can be multiple reasons for the occurrence of this error. While it's easy to deploy and start sending emails, but there is a common error which most of us might be facing. PHPMailer is one of the most popular open-source written in PHP for sending emails. The author voluntarily contributed this tutorial as a part of Pepipost Write to Contribute program.įacing an error which says "PHPMailer SMTP Error: Could not connect to SMTP host"?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |