3

I am taking a tutorial for Django, but stuck at sending email from Django. I am working on Django's built in django.contrib.auth password reset views, it works fine, but doesn;t actually sends any email. For Testing purpose, I am using below code example to send email, but it gives error which I don't know where to resolve.

(env1) C:\Users\crm>python manage.py shell
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.mail import send_mail
>>> send_mail(
...     'Subject here',
...     'Here is the message.',
...     '[email protected]',
...     ['[email protected]'],
...     fail_silently=False,
... )
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Program Files (x86)\Python38-32\lib\site-packages\django\core\mail\__init__.py", line 51, in send_mail
    connection = connection or get_connection(
  File "C:\Program Files (x86)\Python38-32\lib\site-packages\django\core\mail\__init__.py", line 34, in get_connection
    klass = import_string(backend or settings.EMAIL_BACKEND)
  File "C:\Program Files (x86)\Python38-32\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "C:\Program Files (x86)\Python38-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'djago'
>>>
>>>

My Settings.py configuration

EMAIL_BACKEND = 'djago.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USER_TLS = True
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = '******'

1 Answer 1

3

I think you have a typo in your email configuration.

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @Arjun, for pointing my silly typo mistake,I corrected it, but now getting diff error File "C:\Program Files (x86)\Python38-32\lib\site-packages\django\core\mail\backends\smtp.py", line 69, in open self.connection.login(self.username, self.password) File "C:\Program Files (x86)\Python38-32\lib\smtplib.py", line 700, in login raise SMTPNotSupportedError( smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server. >>>
@Aashutosh you have another typo also in your setting. check my answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.