title: PHPMailer, SMTP error on godaddy hosting
body: <p>I know this question has been answered many times but godaddy made some configuration changes at the beginning of 2018 and I can't make my web form to work.</p>
  
  <p>I'm trying to send email with PHPMailer through contact form from a webpage hosted on godaddy.</p>
  
  <p>I'm using the gmail SMTP configuration:</p>
  
  <pre><code>$mail = new PHPMailer();
  $mail-&gt;IsSMTP();
  $mail-&gt;SMTPDebug = 2;
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;SMTPSecure = 'ssl';
  $mail-&gt;Host = "smtp.gmail.com";
  $mail-&gt;Port = 465;
  $mail-&gt;Username = "sender@gmail.com";
  $mail-&gt;Password = "************";
  $mail-&gt;AddReplyTo(sender@gmail.com);
  $mail-&gt;SetFrom(sender@gmail.com);
  $mail-&gt;From = sender@gmail.com;
  $mail-&gt;FromName = Sender Name;
  $mail-&gt;AddAddress(username@domain.com);
  $mail-&gt;Subject = utf8_encode("=?UTF-8?B?" . base64_encode("Email text") . "?=");
  $mail-&gt;MsgHTML("Message");
  $mail-&gt;WordWrap = 450;
  $mail-&gt;IsHTML(true);
  $mail-&gt;Send();
  </code></pre>
  
  <p>This is the error I receive:</p>
  
  <pre><code>SMTP ERROR: Failed to connect to server: Connection refused (111) 2018-04-12 17:08:56   SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 
  Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting   
  </code></pre>
  
  <p>I already try web searching for the issue, check the PHPMailer Troubleshooting and change the configuration parameters but still no able to make it work. Also calling godaddy is not useful, they said that it's a code error.</p>
  
  <p>Same code works on localhost and other hosting.</p>
  
  <p>Thanks in advance.</p>