title: smtp.gmail.com vs ssl://smtp.gmail.com while sending email using gmail smtp server
body: <p>According to <a href="https://support.google.com/a/answer/176600?hl=en" rel="nofollow noreferrer">this</a></p>
  
  <blockquote>
    <p>Gmail SMTP Server could also be used to relay messages from your
    device or application. You can connect to Gmail mail servers using
    SMTP, SSL/TLS. If you connect using SMTP, you can only send mail to
    Gmail or Google Apps users; if you connect using SSL/TLS, you can send
    mail to anyone.</p>
    
    <p>If your device or application supports SSL - connect to smtp.gmail.com
    on port 465.</p>
  </blockquote>
  
  <p>So I tried connecting to smtp.gmail.com on port 465. I got the following error:</p>
  
  <blockquote>
    <p>Unable to send email using PHP SMTP. Your server might not be
    configured to send mail using this method.</p>
  </blockquote>
  
  <p>Some <a href="https://stackoverflow.com/questions/1555145/">code</a> uses another address "ssl://smtp.gmail.com".</p>
  
  <p>When I use ssl://smtp.gmail.com also on port 465, my application now works correctly.</p>
  
  <ul>
  <li>What's the difference between ssl://smtp.gmail.com and smtp.gmail.com if the latter also uses ssl?</li>
  <li>Why can't we send emails to other domains without SSL? Is this only done by gmail for security purposes?</li>
  </ul>
  
  <p>I am extremely new at this. Can anyone explain? I am using php if it matters.</p>