title: Django 1.8 sending mail using gmail SMTP
body: <p>I was trying send a mail using <code>smtp.gmail.com</code> in django 1.8</p>
  <p>My <code>settings.py</code> contains:</p>
  <pre class="lang-py prettyprint-override"><code>EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'  
  EMAIL_HOST='smtp.gmail.com'  
  EMAIL_PORT=465  
  EMAIL_HOST_USER = 'sarath4coding'  
  EMAIL_HOST_PASSWORD = '*********'  
  DEFAULT_EMAIL_FROM = 'sarath4coding@gmail.com'
  </code></pre>
  <pre><code>from django.core import mail
  mail.send_mail('subject','message','sarath4coding@gmail.com',['sarath4coding@gmail.com'])
  </code></pre>
  <p>But got this error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;&lt;console&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/home/manager/dj1.8/local/lib/python2.7/site-packages/django/core/mail/__init__.py&quot;, line 62, in send_mail
      return mail.send()
    File &quot;/home/manager/dj1.8/local/lib/python2.7/site-packages/django/core/mail/message.py&quot;, line 303, in send
      return self.get_connection(fail_silently).send_messages([self])
    File &quot;/home/manager/dj1.8/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py&quot;, line 100, in send_messages
      new_conn_created = self.open()
    File &quot;/home/manager/dj1.8/local/lib/python2.7/site-packages/django_smtp_ssl.py&quot;, line 14, in open
      self.connection.login(self.username, self.password)
    File &quot;/usr/lib/python2.7/smtplib.py&quot;, line 622, in login
      raise SMTPAuthenticationError(code, resp)
  SMTPAuthenticationError: (534, '5.7.14 &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbuze\n5.7.14 2FDKQt2Dlo2vqFIvbr6DnBItwWvh9DChPwbeTZO66N91gzmiA437Vqs80cZ9-8u13vxq5a\n5.7.14 bVahzO_BQcZ53yKbJ-YbAlmFE1XIK7MfH97O0wI1lvzpTG_WAHuTIBF0HD1GA2icUoUemt\n5.7.14 ErZn4qb942aAIMG103FnrzLp4txXTbXC-wGLpaz5yvnUN5thahvv3-RiIVW8F1QddZKZlg\n5.7.14 qQKpqWw56zr1AcO2s_oaBEt556fQ&gt; Please log in via your web browser and\n5.7.14 then try again.\n5.7.14  Learn more at\n5.7.14  https://support.google.com/mail/answer/78754 kx14sm6579665pab.0 - gsmtp')
  </code></pre>
  <p>I tried everything the document says and followed many suggested solutions.</p>
  <p>like <a href="https://accounts.google.com/DisplayUnlockCaptcha" rel="nofollow noreferrer">https://accounts.google.com/DisplayUnlockCaptcha</a>, enabling low security apps etc.</p>
  <p>but I still got errors</p>
  <p>Can anybody tell how to properly configure Django 1.8 to send mail using Gmail.</p>