2
votes

I have deployed my web project on Pythonanywhere. Im sending email with gmail SMTP but i want to send with Office365 (company account). I used many options but i didnt figure it out. It exists in whitelist of Pythonanywhere

It throws that error:

Expection value : [Errno 101] Network is unreachable

in my settings.py like that:

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

EMAIL_HOST = 'smtp.office365.com'

EMAIL_HOST_USER = '[email protected]'

EMAIL_HOST_PASSWORD = '########'

EMAIL_PORT = 587

EMAIL_USE_TLS = True

DEFAULT_FROM_EMAIL = '[email protected]'

SERVER_EMAIL = '[email protected]'

Thank you all.

1

1 Answers

2
votes

Free accounts on PythonAnywhere can only connect to the whitelisted external servers using HTTP or HTTPS; you're trying to connect using SMTP, which is a different protocol. If you want to send email from a free account, you need to either use GMail, or use an HTTPS-based email solution like MailGun or SendGrid. Alternatively, you could upgrade to a paid account, which would allow you to use SMTP to other servers.

There's more information on this PythonAnywhere help page.