Guest User

Untitled

a guest
Dec 18th, 2017
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. from django.core import mail
  2. mail.send_mail('subject','message','sarath4coding@gmail.com',['sarath4coding@gmail.com'])
  3.  
  4. Traceback (most recent call last):
  5. File "<console>", line 1, in <module>
  6. File "/home/manager/dj1.8/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 62, in send_mail
  7. return mail.send()
  8. File "/home/manager/dj1.8/local/lib/python2.7/site-packages/django/core/mail/message.py", line 303, in send
  9. return self.get_connection(fail_silently).send_messages([self])
  10. File "/home/manager/dj1.8/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 100, in send_messages
  11. new_conn_created = self.open()
  12. File "/home/manager/dj1.8/local/lib/python2.7/site-packages/django_smtp_ssl.py", line 14, in open
  13. self.connection.login(self.username, self.password)
  14. File "/usr/lib/python2.7/smtplib.py", line 622, in login
  15. raise SMTPAuthenticationError(code, resp)
  16. SMTPAuthenticationError: (534, '5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbuzen5.7.14 2FDKQt2Dlo2vqFIvbr6DnBItwWvh9DChPwbeTZO66N91gzmiA437Vqs80cZ9-8u13vxq5an5.7.14 bVahzO_BQcZ53yKbJ-YbAlmFE1XIK7MfH97O0wI1lvzpTG_WAHuTIBF0HD1GA2icUoUemtn5.7.14 ErZn4qb942aAIMG103FnrzLp4txXTbXC-wGLpaz5yvnUN5thahvv3-RiIVW8F1QddZKZlgn5.7.14 qQKpqWw56zr1AcO2s_oaBEt556fQ> Please log in via your web browser andn5.7.14 then try again.n5.7.14 Learn more atn5.7.14 https://support.google.com/mail/answer/78754 kx14sm6579665pab.0 - gsmtp')
  17.  
  18. EMAIL_USE_TLS = True
  19. EMAIL_HOST = 'smtp.gmail.com'
  20. EMAIL_HOST_USER = 'test@gmail.com'
  21. EMAIL_HOST_PASSWORD = 'test'
  22. EMAIL_PORT = 587
  23.  
  24. from django.core.mail import EmailMessage
  25.  
  26. email = EmailMessage('title', 'body', to=[email])
  27. email.send()
  28.  
  29. import django
  30. from django.conf import settings
  31. from django.core.mail import send_mail
  32.  
  33. send_mail('Subject here', 'Here is the message.', settings.EMAIL_HOST_USER,
  34. ['to@example.com'], fail_silently=False)
  35.  
  36. EMAIL_USE_TLS = True
  37. EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  38. EMAIL_HOST = 'smtp.gmail.com'
  39. EMAIL_HOST_PASSWORD = 'xxxx' #my gmail password
  40. EMAIL_HOST_USER = 'xxxx@gmail.com' #my gmail username
  41. EMAIL_PORT = 587
  42. DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
  43.  
  44. EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
  45.  
  46. EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend'
  47. EMAIL_HOST = 'smtp.gmail.com'
  48. EMAIL_HOST_PASSWORD = 'test'
  49. EMAIL_HOST_USER = 'test@gmail.com'
  50. EMAIL_PORT = 587
  51. EMAIL_USE_TLS = True
  52.  
  53. email = EmailMessage(
  54. 'subject_message',
  55. 'content_message',
  56. 'sender smtp gmail' +'<sender@gmail.com>',
  57. ['receiver@gmail.com'],
  58. headers = {'Reply-To': 'contact_email@gmail.com' }
  59. )
  60. email.send()
Add Comment
Please, Sign In to add comment