shekhar
shekhar

Reputation: 161

"Path for saving emails is invalid: None" in django

my project was running correctly but after that I made few apps I start my work on previous app but I'm trying to send email this time I'm getting this error and I'm not able to understand what's the problem, I tried to get email and console and it's working but when I use

EMAIL_BACKEND = django.core.mail.backends.smtp.EmailBackend

I get this error, can someone help to figure it out what's the problem this is image of error link

EMAIL_BACKEND = config('EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')
EMAIL_HOST = config('EMAIL_HOST', cast=Csv())
EMAIL_PORT = config('EMAIL_PORT', cast=int)
EMAIL_USE_TLS = config('EMAIL_USE_TLS', cast=bool)
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')

This is what I'm using in my settings

Upvotes: 0

Views: 998

Answers (1)

ruddra
ruddra

Reputation: 51978

I think you are using django.core.mail.backends.filebased.EmailBackend instead of django.core.mail.backends.smtp.EmailBackend in your settings.py. Or you could be using get_connection method to use a backend when sending an email like this:

connection = get_connection(backend="django.core.mail.backends.filebased.EmailBackend")
# some other code
connection.send_messages(messages)

If you do, then make sure to set EMAIL_FILE_PATH in settings.py:

EMAIL_FILE_PATH = '/tmp/app-messages'  # Proper path should be given here

More details can be found here: https://docs.djangoproject.com/en/2.1/topics/email/#file-backend

Upvotes: 1

Related Questions