SMTP AUTH extension not supported by server in Django
Im being building an project using django framework and for now i wanted to test wether i can send emails to any users locally. So wrote this code in settings.py and got the error saying that SMTP AUTH extension not supported by server. So i researched everything but didnt find why this error has been raised and do smtp needs authentication? Please let know how i can solve this problem
settings.py
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = config('EMAIL_HOST',cast=str, default = 'smtp.gmail.com')
EMAIL_PORT = config('EMAIL_PORT',cast=str,default="587")
EMAIL_USE_TSL = config('EMAIL_USE_TSL',cast=bool,default=True)
EMAIL_USE_SSL = config('EMAIL_USE_SSL',cast=bool,default=False)
EMAIL_HOST_USER = config('EMAIL_HOST_USER',cast=str,default=None)
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD',cast=str,default=None)
ADMIN_USER_NAME = config('ADMIN_USER_NAME',default = "Admin user")
ADMIN_USER_EMAIL = config('ADMIN_USER_EMAIL',default = None)
MANAGERS = []
ADMINS = []
if all([ADMIN_USER_NAME, ADMIN_USER_EMAIL]):
ADMINS += [
(f'{ADMIN_USER_NAME}', f'{ADMIN_USER_EMAIL}')
]
MANAGERS = ADMINS
Error im getting is this :
Traceback (most recent call last):
File "C:\Indraneel_coding\Django\Saas\src\manage.py", line 22, in <module>
main()
File "C:\Indraneel_coding\Django\Saas\src\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\management\base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\management\commands\sendtestemail.py", line 46, in handle
mail_admins(subject, "This email was sent to the site admins.")
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\mail\__init__.py", line 135, in mail_admins
mail.send(fail_silently=fail_silently)
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\mail\message.py", line 301, in send
return self.get_connection(fail_silently).send_messages([self])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\mail\backends\smtp.py", line 128, in send_messages
new_conn_created = self.open()
^^^^^^^^^^^
File "C:\Indraneel_coding\Django\Saas\venv\Lib\site-packages\django\core\mail\backends\smtp.py", line 95, in open
self.connection.login(self.username, self.password)
File "C:\Users\bhava\AppData\Local\Programs\Python\Python312\Lib\smtplib.py", line 716, in login
raise SMTPNotSupportedError(
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
let me know if anything is needed for your understanding
I tried using EMAIL_BACKEND = "django.core.mail.backends.console.smtp.EmailBackend"
this didnt gave me the above error but it rather printed the email format in the console and didnt send the email message to desired email address