Using PHPMailer on Hostgator (timeout when try to login into SMTP server)Problems when using IIS SMTP Pickup...

Unbreakable Formation vs. Cry of the Carnarium

How to move the player while also allowing forces to affect it

Why is my log file so massive? 22gb. I am running log backups

Is there a way to make member function NOT callable from constructor?

Symmetry in quantum mechanics

Does the average primeness of natural numbers tend to zero?

Was there ever an axiom rendered a theorem?

What to wear for invited talk in Canada

Is there a name of the flying bionic bird?

Is domain driven design an anti-SQL pattern?

aging parents with no investments

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

Does it makes sense to buy a new cycle to learn riding?

Ideas for 3rd eye abilities

Can I find out the caloric content of bread by dehydrating it?

Is every set a filtered colimit of finite sets?

What's the difference between repeating elections every few years and repeating a referendum after a few years?

Can a planet have a different gravitational pull depending on its location in orbit around its sun?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Is Social Media Science Fiction?

Is "plugging out" electronic devices an American expression?

Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?

Check if two datetimes are between two others

How to create a consistent feel for character names in a fantasy setting?



Using PHPMailer on Hostgator (timeout when try to login into SMTP server)


Problems when using IIS SMTP Pickup ServiceHow do I format a text file for IIS Mailroot Pickup so that it sends an e-mail with attachments?Trying to use a SmartHost with my Exchange 2010 serverPostfix & TLS is configured correctly, but Thunderbird throws cryptic errors when trying to send email via SMTP & STARTTLS?Joomla SMTP Configuration IssueProblems opening port 465 for smtp on centosShould I block the other SMTP ports as well to block outgoing mail?Exchange 2010: not receiving NDR when sending email using SMTP to none existing external mailboxPHPMailer with SSL - CentOS 6.7 VPS - SMTP ERROR: Failed to connect to server: (0)Exim and PHPMailer: can't accept authentication when host is localhost






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















Solved: The problem was that to use the service through hostgator, for some reason the user must log in using main dsn name and not the SMTP domain name.



I was using the simple PHP mail() function to send emails and it was working fine but it didn't require to login into SMPT server. When I moved to PHPMailer library I wrote this code to send email but I'm having timeout when when trying to do this login. According to info from hostgator, the SMTP server (with SSL/TSL) is at port 465. So I wrote:



$mail = new PHPMailer;

$mail->SMTPDebug = 3;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.mydomain.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'contact@mydomain.com'; // SMTP username
$mail->Password = 'pass'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('contact@mydomain.com', 'my name');
$mail->addAddress('....@gmail.com', 'someone'); // Add a recipient

$mail->addReplyTo('contact@mydomain.com', 'my name');
$mail->isHTML(true); // Set email format to HTML

$mail->Subject = 'subject';
$mail->Body = 'msg body <b>bold!</b>';
$mail->AltBody = 'Corpo alternativo caso o primeiro não seja exibido';

if(!$mail->send())
{
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent';
}


But when this php file is called, besides not showing the echo I placed before the code, it also waited the 300 seconds to open a modal warning me of the timeout error. Thanks in advance.










share|improve this question
















bumped to the homepage by Community 26 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Check that you are trying to connect to the right host.

    – Michael Hampton
    Mar 2 '16 at 0:31











  • Well, I went to this email's account page and searched for it's configs. There it said Outgoing Server: mail.mydomain.com SMTP Port: 465 I just changed to "my domain" here but it is the same string. I'm using port 465 because it's through there to send using SSL/TLS

    – fabionr
    Mar 2 '16 at 0:36











  • I think you should have a chat with the service provider, then. The timeout in this circumstance is generally an indication that the connection has been firewalled.

    – Michael Hampton
    Mar 2 '16 at 0:38


















1















Solved: The problem was that to use the service through hostgator, for some reason the user must log in using main dsn name and not the SMTP domain name.



I was using the simple PHP mail() function to send emails and it was working fine but it didn't require to login into SMPT server. When I moved to PHPMailer library I wrote this code to send email but I'm having timeout when when trying to do this login. According to info from hostgator, the SMTP server (with SSL/TSL) is at port 465. So I wrote:



$mail = new PHPMailer;

$mail->SMTPDebug = 3;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.mydomain.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'contact@mydomain.com'; // SMTP username
$mail->Password = 'pass'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('contact@mydomain.com', 'my name');
$mail->addAddress('....@gmail.com', 'someone'); // Add a recipient

$mail->addReplyTo('contact@mydomain.com', 'my name');
$mail->isHTML(true); // Set email format to HTML

$mail->Subject = 'subject';
$mail->Body = 'msg body <b>bold!</b>';
$mail->AltBody = 'Corpo alternativo caso o primeiro não seja exibido';

if(!$mail->send())
{
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent';
}


But when this php file is called, besides not showing the echo I placed before the code, it also waited the 300 seconds to open a modal warning me of the timeout error. Thanks in advance.










share|improve this question
















bumped to the homepage by Community 26 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Check that you are trying to connect to the right host.

    – Michael Hampton
    Mar 2 '16 at 0:31











  • Well, I went to this email's account page and searched for it's configs. There it said Outgoing Server: mail.mydomain.com SMTP Port: 465 I just changed to "my domain" here but it is the same string. I'm using port 465 because it's through there to send using SSL/TLS

    – fabionr
    Mar 2 '16 at 0:36











  • I think you should have a chat with the service provider, then. The timeout in this circumstance is generally an indication that the connection has been firewalled.

    – Michael Hampton
    Mar 2 '16 at 0:38














1












1








1








Solved: The problem was that to use the service through hostgator, for some reason the user must log in using main dsn name and not the SMTP domain name.



I was using the simple PHP mail() function to send emails and it was working fine but it didn't require to login into SMPT server. When I moved to PHPMailer library I wrote this code to send email but I'm having timeout when when trying to do this login. According to info from hostgator, the SMTP server (with SSL/TSL) is at port 465. So I wrote:



$mail = new PHPMailer;

$mail->SMTPDebug = 3;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.mydomain.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'contact@mydomain.com'; // SMTP username
$mail->Password = 'pass'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('contact@mydomain.com', 'my name');
$mail->addAddress('....@gmail.com', 'someone'); // Add a recipient

$mail->addReplyTo('contact@mydomain.com', 'my name');
$mail->isHTML(true); // Set email format to HTML

$mail->Subject = 'subject';
$mail->Body = 'msg body <b>bold!</b>';
$mail->AltBody = 'Corpo alternativo caso o primeiro não seja exibido';

if(!$mail->send())
{
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent';
}


But when this php file is called, besides not showing the echo I placed before the code, it also waited the 300 seconds to open a modal warning me of the timeout error. Thanks in advance.










share|improve this question
















Solved: The problem was that to use the service through hostgator, for some reason the user must log in using main dsn name and not the SMTP domain name.



I was using the simple PHP mail() function to send emails and it was working fine but it didn't require to login into SMPT server. When I moved to PHPMailer library I wrote this code to send email but I'm having timeout when when trying to do this login. According to info from hostgator, the SMTP server (with SSL/TSL) is at port 465. So I wrote:



$mail = new PHPMailer;

$mail->SMTPDebug = 3;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.mydomain.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'contact@mydomain.com'; // SMTP username
$mail->Password = 'pass'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465; // TCP port to connect to
$mail->setFrom('contact@mydomain.com', 'my name');
$mail->addAddress('....@gmail.com', 'someone'); // Add a recipient

$mail->addReplyTo('contact@mydomain.com', 'my name');
$mail->isHTML(true); // Set email format to HTML

$mail->Subject = 'subject';
$mail->Body = 'msg body <b>bold!</b>';
$mail->AltBody = 'Corpo alternativo caso o primeiro não seja exibido';

if(!$mail->send())
{
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent';
}


But when this php file is called, besides not showing the echo I placed before the code, it also waited the 300 seconds to open a modal warning me of the timeout error. Thanks in advance.







php smtp timeout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 5 '16 at 20:58









angelcool.net

236213




236213










asked Mar 2 '16 at 0:16









fabionrfabionr

615




615





bumped to the homepage by Community 26 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 26 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Check that you are trying to connect to the right host.

    – Michael Hampton
    Mar 2 '16 at 0:31











  • Well, I went to this email's account page and searched for it's configs. There it said Outgoing Server: mail.mydomain.com SMTP Port: 465 I just changed to "my domain" here but it is the same string. I'm using port 465 because it's through there to send using SSL/TLS

    – fabionr
    Mar 2 '16 at 0:36











  • I think you should have a chat with the service provider, then. The timeout in this circumstance is generally an indication that the connection has been firewalled.

    – Michael Hampton
    Mar 2 '16 at 0:38



















  • Check that you are trying to connect to the right host.

    – Michael Hampton
    Mar 2 '16 at 0:31











  • Well, I went to this email's account page and searched for it's configs. There it said Outgoing Server: mail.mydomain.com SMTP Port: 465 I just changed to "my domain" here but it is the same string. I'm using port 465 because it's through there to send using SSL/TLS

    – fabionr
    Mar 2 '16 at 0:36











  • I think you should have a chat with the service provider, then. The timeout in this circumstance is generally an indication that the connection has been firewalled.

    – Michael Hampton
    Mar 2 '16 at 0:38

















Check that you are trying to connect to the right host.

– Michael Hampton
Mar 2 '16 at 0:31





Check that you are trying to connect to the right host.

– Michael Hampton
Mar 2 '16 at 0:31













Well, I went to this email's account page and searched for it's configs. There it said Outgoing Server: mail.mydomain.com SMTP Port: 465 I just changed to "my domain" here but it is the same string. I'm using port 465 because it's through there to send using SSL/TLS

– fabionr
Mar 2 '16 at 0:36





Well, I went to this email's account page and searched for it's configs. There it said Outgoing Server: mail.mydomain.com SMTP Port: 465 I just changed to "my domain" here but it is the same string. I'm using port 465 because it's through there to send using SSL/TLS

– fabionr
Mar 2 '16 at 0:36













I think you should have a chat with the service provider, then. The timeout in this circumstance is generally an indication that the connection has been firewalled.

– Michael Hampton
Mar 2 '16 at 0:38





I think you should have a chat with the service provider, then. The timeout in this circumstance is generally an indication that the connection has been firewalled.

– Michael Hampton
Mar 2 '16 at 0:38










2 Answers
2






active

oldest

votes


















0














I think the answer is in your code. You have lines like $mail->Host = 'mail.mydomain.com'; Be sure to switch all these out with actual domains. You have to use your www.com website domain.



The following is wrong.



$mail->Host       = 'mail.mydomain.com';               // Specify main and backup SMTP servers


I'm not surprised it won't send. Swap all the values out with real strings that matter to your site.






share|improve this answer

































    -1














    There are some differences between how PHP's mail() function and the PHP Mailer work. The mail() function sends mail directly from the server where the script is located whereas your hosting provider might be using a separate server to send their emails. Therefore, I'd recommend you to set the SMTP server's FQDN as $mail->Host and make sure that the $mail->SMTPSecure property should be in fact tls or ssl.



    However, there might be a lot of reasons why your code isn't working and unless you post the exact code that you are using (without the password, of course), I doubt that adequate assistance could be provided. It is also recommended to contact the web hosting support.






    share|improve this answer
























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "2"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f760861%2fusing-phpmailer-on-hostgator-timeout-when-try-to-login-into-smtp-server%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      I think the answer is in your code. You have lines like $mail->Host = 'mail.mydomain.com'; Be sure to switch all these out with actual domains. You have to use your www.com website domain.



      The following is wrong.



      $mail->Host       = 'mail.mydomain.com';               // Specify main and backup SMTP servers


      I'm not surprised it won't send. Swap all the values out with real strings that matter to your site.






      share|improve this answer






























        0














        I think the answer is in your code. You have lines like $mail->Host = 'mail.mydomain.com'; Be sure to switch all these out with actual domains. You have to use your www.com website domain.



        The following is wrong.



        $mail->Host       = 'mail.mydomain.com';               // Specify main and backup SMTP servers


        I'm not surprised it won't send. Swap all the values out with real strings that matter to your site.






        share|improve this answer




























          0












          0








          0







          I think the answer is in your code. You have lines like $mail->Host = 'mail.mydomain.com'; Be sure to switch all these out with actual domains. You have to use your www.com website domain.



          The following is wrong.



          $mail->Host       = 'mail.mydomain.com';               // Specify main and backup SMTP servers


          I'm not surprised it won't send. Swap all the values out with real strings that matter to your site.






          share|improve this answer















          I think the answer is in your code. You have lines like $mail->Host = 'mail.mydomain.com'; Be sure to switch all these out with actual domains. You have to use your www.com website domain.



          The following is wrong.



          $mail->Host       = 'mail.mydomain.com';               // Specify main and backup SMTP servers


          I'm not surprised it won't send. Swap all the values out with real strings that matter to your site.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 17 '17 at 2:56









          chicks

          3,05072033




          3,05072033










          answered Apr 16 '17 at 22:25









          user2296112user2296112

          1




          1

























              -1














              There are some differences between how PHP's mail() function and the PHP Mailer work. The mail() function sends mail directly from the server where the script is located whereas your hosting provider might be using a separate server to send their emails. Therefore, I'd recommend you to set the SMTP server's FQDN as $mail->Host and make sure that the $mail->SMTPSecure property should be in fact tls or ssl.



              However, there might be a lot of reasons why your code isn't working and unless you post the exact code that you are using (without the password, of course), I doubt that adequate assistance could be provided. It is also recommended to contact the web hosting support.






              share|improve this answer




























                -1














                There are some differences between how PHP's mail() function and the PHP Mailer work. The mail() function sends mail directly from the server where the script is located whereas your hosting provider might be using a separate server to send their emails. Therefore, I'd recommend you to set the SMTP server's FQDN as $mail->Host and make sure that the $mail->SMTPSecure property should be in fact tls or ssl.



                However, there might be a lot of reasons why your code isn't working and unless you post the exact code that you are using (without the password, of course), I doubt that adequate assistance could be provided. It is also recommended to contact the web hosting support.






                share|improve this answer


























                  -1












                  -1








                  -1







                  There are some differences between how PHP's mail() function and the PHP Mailer work. The mail() function sends mail directly from the server where the script is located whereas your hosting provider might be using a separate server to send their emails. Therefore, I'd recommend you to set the SMTP server's FQDN as $mail->Host and make sure that the $mail->SMTPSecure property should be in fact tls or ssl.



                  However, there might be a lot of reasons why your code isn't working and unless you post the exact code that you are using (without the password, of course), I doubt that adequate assistance could be provided. It is also recommended to contact the web hosting support.






                  share|improve this answer













                  There are some differences between how PHP's mail() function and the PHP Mailer work. The mail() function sends mail directly from the server where the script is located whereas your hosting provider might be using a separate server to send their emails. Therefore, I'd recommend you to set the SMTP server's FQDN as $mail->Host and make sure that the $mail->SMTPSecure property should be in fact tls or ssl.



                  However, there might be a lot of reasons why your code isn't working and unless you post the exact code that you are using (without the password, of course), I doubt that adequate assistance could be provided. It is also recommended to contact the web hosting support.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 30 '18 at 7:25









                  ElhitchElhitch

                  1011




                  1011






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Server Fault!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f760861%2fusing-phpmailer-on-hostgator-timeout-when-try-to-login-into-smtp-server%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

                      Список ссавців Італії Природоохоронні статуси | Список |...

                      Українські прізвища Зміст Історичні відомості |...