django发送电子邮件:SMTPAuthenticationError

时间:2015-03-12 04:32:11

标签: python django email

使用django发送电子邮件时收到错误,

 Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/apsijogja/djangogirls/myvenv/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 62, in send_mail
    return mail.send()
  File "/home/apsijogja/djangogirls/myvenv/local/lib/python2.7/site-packages/django/core/mail/message.py", line 286, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/home/apsijogja/djangogirls/myvenv/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 92, in send_messages
    new_conn_created = self.open()
  File "/home/apsijogja/djangogirls/myvenv/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 59, in open
    self.connection.login(self.username, self.password)
  File "/usr/lib/python2.7/smtplib.py", line 613, in login
    raise SMTPAuthenticationError(code, resp)
SMTPAuthenticationError: (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 g10sm8484662pdm.29 - gsmtp')

这是setting.py

CCOUNT_ACTIVATION_DAYS = 3
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'myemail@gmail.com'
EMAIL_HOST_PASSWORD = 'blahblah'
EMAIL_PORT = 587
EMAIL_USE_TLS = 1

LOGIN_REDIRECT_URL = '/'

我已尝试使用此链接https://support.google.com/mail/answer/14257,但我收到同样的错误。

你可以帮我解决这个问题吗?

0 个答案:

没有答案