Django - [Errno 111] Connection refused
Looks like you are trying to send a mail (send_mail()
) and your mail settings in your settings.py
are not correct.
You should check the docs for sending emails.
For debugging purposes you could setup a local smtpserver with this command:
python -m smtpd -n -c DebuggingServer localhost:1025
and adjust your mail settings accordingly:
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
This is documented here: Testing e-mail sending
As an alternative to starting a dedicated debugging server you could use the console.EmailBackend
which was added to Django recently.
For Development and Testing:
In Django 1.6+ we can just add this line in settings.py
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
This will display the mail on the console for Easy Verification.
Note: Mail will not be sent to the specified recipient in Msg.Its just for Development and Testing.
For that you need to configure SMTP server which is given in the Doc.
For Reference: Django Documentation for Sending Email