title: PHP: Use Google's SMTP relay with SwiftMailer
body: <p>I want to use Google's <a href="https://support.google.com/a/answer/2956491?hl=en" rel="nofollow noreferrer">SMTP relay</a> service as a SMTP server in PHP.</p>
  
  <p>The IP address is whitelisted for the SMTP relay service, and I am using the <a href="https://swiftmailer.symfony.com/" rel="nofollow noreferrer">SwiftMailer</a> as a PHP library to send emails.</p>
  
  <p>I configured the SMTP service to use TLS encryption, and set the following parameters for the SwiftMailer:</p>
  
  <pre><code>transport: smtp
  host: smtp-relay.gmail.com
  port: 587
  encryption: tls
  auth_mode: login
  </code></pre>
  
  <p>I was able to send emails via telnet, but when I try to send emails with SwiftMailer with the above configuration, I receive the following error:</p>
  
  <pre><code>[CLOSED] IMAP connection broken (server response) (errflg=2)
  </code></pre>
  
  <p>How can I configure the SwiftMailer to use Google SMTP relay service as its SMTP server? Is it ever possible?</p>