title: Can't send mail with SwiftMailer using SmtpTransport in live environment but can send in localhost
body: <p>I am using SwiftMailer to send a simple mail. But when I use the <strong>SmtpTransport</strong> (with host, username and a password) method, I get the following error of using 2 possible authenticators. I searched the issue on stackoverflow but could not find a solution.</p>
  
  <pre><code>Fatal error: Uncaught exception 'Swift_TransportException' with message 'Failed to authenticate on SMTP server with username "xxx@yyyyyyyy.com" using 2 possible authenticators' in /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php:181 Stack trace: #0 
  /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(307): Swift_Transport_Esmtp_AuthHandler-&gt;afterEhlo(Object(Swift_SmtpTransport)) #1 
  /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(118): Swift_Transport_EsmtpTransport-&gt;_doHeloCommand() #2 
  /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport-&gt;start() #3 
  /home/yyyyyyyy/public_html/testmail.php(51): Swift_Mailer-&gt;send(Object(Swift_Message)) #4 {main} thrown in /home/lexington21/public_html/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php on line 181
  </code></pre>
  
  <p>My source is as follows. This source work perfectly in my localhost but not when it is uploaded to the live environment.</p>
  
  <pre><code>$transport = Swift_SmtpTransport::newInstance("SMTPHOST", 25)
  -&gt;setUsername("user")
  -&gt;setPassword("pass");
  
  $mailer = Swift_Mailer::newInstance($transport);
  
  $to = "abc@aaa.com";
  $subject = "Test Mail";
  $email_body = "Hi Please confirm if you have received this email.";
  
  $mail = Swift_Message::newInstance($subject)
  -&gt;setFrom(array("research@lexingtonstudies.com"))
  -&gt;setTo(array($to))
  -&gt;setBcc(array("bcc1@aaa.com", "bcc2@bbb.com"))
  -&gt;setBody($email_body, 'text/html');
  
  $mailing_result = $mailer-&gt;send($mail);
  </code></pre>
  
  <p>I used 465 with ssl but got this error.</p>
  
  <pre><code>Swift_SmtpTransport::newInstance("SMTPHOST", 465, 'ssl')
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host SMTPHOST [Connection refused #111]' in /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:265 Stack trace: #0 
  /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(62): Swift_Transport_StreamBuffer-&gt;_establishSocketConnection() #1 
  /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(113): Swift_Transport_StreamBuffer-&gt;initialize(Array) #2 
  /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport-&gt;start() #3 
  /home/yyyyyyyy/public_html/testmail.php(51): Swift_Mailer-&gt;send(Object(Swift_Message)) #4 {main} thrown in /home/yyyyyyyy/public_html/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php on line 265
  </code></pre>
  
  <p>Please help me solve this.</p>