title: SMTP config for gmail?
body: <p>I am trying to configure an Email notification in TeamCity server.</p>
  
  <p>I read <a href="https://confluence.jetbrains.com/display/TCD10/Setting+up+Google+Mail+and+Google+Talk+as+Notification+Servers" rel="nofollow">this</a> and <a href="https://support.google.com/mail/answer/7104828?visit_id=1-636122998231733350-823687448&amp;rd=3" rel="nofollow">this</a> documentation, and tried to set the configs</p>
  
  <p>Here are 2 configs which I tried and the respective errors I receive when I press the <code>Test connection</code> button below it:</p>
  
  <h2>Config 1</h2>
  
  <pre><code>SMTP host: smtp.gmail.com
  SMTP port: 465
  Send email messages from: foobar@gmail.com
  SMTP login: foobar@gmail.com
  SMTP password: •••••••••
  Secure connection: SSL
  </code></pre>
  
  <h3>Error:</h3>
  
  <blockquote>
    <p>javax.mail.MessagingException: Could not connect to SMTP host:
    smtp.gmail.com, port: 465;   nested exception is:
    javax.net.ssl.SSLHandshakeException:
    sun.security.validator.ValidatorException: PKIX path building failed:
    sun.security.provider.certpath.SunCertPathBuilderException: unable to
    find valid certification path to requested target</p>
  </blockquote>
  
  <h2>Config 2</h2>
  
  <pre><code>SMTP host: smtp.gmail.com
  SMTP port: 587
  Send email messages from: foobar@gmail.com
  SMTP login: foobar@gmail.com
  SMTP password: •••••••••
  Secure connection: StartTSL
  </code></pre>
  
  <h3>Error:</h3>
  
  <blockquote>
    <p>javax.mail.MessagingException: Could not convert socket to TLS;<br>
    nested exception is: javax.net.ssl.SSLHandshakeException:
    sun.security.validator.ValidatorException: PKIX path building failed:
    sun.security.provider.certpath.SunCertPathBuilderException: unable to
    find valid certification path to requested target</p>
  </blockquote>
  
  <p>What is going wrong over here?</p>