title: Swift_TransportException Connection could not be established with host smtp.gmail.com
body: <p>I can't figure for the life of me why exactly is it failing.. this is the exact error I am getting:</p>
  
  <pre><code>Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection  
  could not be established with host smtp.gmail.com [Connection refused #111]' in 
  /home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php:259 
  Stack trace: #0 
  /home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php(64): 
  Swift_Transport_StreamBuffer-&gt;_establishSocketConnection() #1 /home/content/38/6896038/html/test/lib/classes/Swift/Transport/AbstractSmtpTransport.php(115): Swift_Transport_StreamBuffer-&gt;initialize(Array) #2 /home/content/38/6896038/html/test/lib/classes/Swift/Mailer.php(80): Swift_Transport_AbstractSmtpTransport-&gt;start() #3 /home/content/38/6896038/html/test/contact.php(55): Swift_Mailer-&gt;send(Object(Swift_Message)) #4 {main} thrown in /home/content/38/6896038/html/test/lib/classes/Swift/Transport/StreamBuffer.php on line 259
  </code></pre>
  
  <p>And the code Im using is what I've gotten from the tutorial and reading on here examples, here it is:</p>
  
  <pre><code>require_once 'lib/swift_required.php';
  
  $transport = Swift_MailTransport::newInstance();
  
  // Create the Transport the call setUsername() and setPassword()
  $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
    -&gt;setUsername('email@googleappsdomain.com')
    -&gt;setPassword('xxx')
    ;
  
  // Create the Mailer using your created Transport
  $mailer = Swift_Mailer::newInstance($transport);
  
  $nombre = $_POST['name'];
  $apellido = $_POST['apellido'];
  $email = $_POST['email'];
  $telefono = $_POST['telefono'];
  $title = $_POST['jobtitle'];
  
  // Create the message
  $message = Swift_Message::newInstance()
  
    // Give the message a subject
    -&gt;setSubject('Nuevo applicante para: ' . $title)
  
    // Set the From address with an associative array
    -&gt;setFrom(array('no-reply@topytop.com.pe' =&gt; 'no-reply'))
  
    // Set the To addresses with an associative array
    -&gt;setTo('email@thisemail.com')
  
    // Give it a body
    -&gt;setBody('&lt;html&gt;
                  &lt;head&gt;&lt;/head&gt;
                  &lt;body&gt;
                      &lt;table&gt;
                          &lt;tr&gt;
                              &lt;td&gt;Nombre:&lt;/td&gt;&lt;td&gt;' . $nombre . ' ' . $apellido .'&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;Email:&lt;/td&gt;&lt;td&gt;' . $email . '&lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;Telefono:&lt;/td&gt;&lt;td&gt;'. $telefono .'&lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/body&gt;
              &lt;/html&gt;', 'text/html')
  
    // Optionally add any attachments
    -&gt;attach(Swift_Attachment::fromPath($_FILES["file"]["tmp_name"])-&gt;setFilename($_FILES['file']['name']));
  
  // Send the message
  $result = $mailer-&gt;send($message);
  </code></pre>
  
  <p>any help is greatly appreciated, I've done my reading and searching and cannot find a solution to this :(</p>
  
  <p>EDIT: Apparently it's an issue with gmail, I changed to a different smtp and it worked.. :S</p>