Django email backend with local smtp
Asked Answered
P

2

8

I want send email from django application.

I want send an email to my mail id from other username without authentication. Just i used smtp server for the authenticated mail.In the django mail api How it is supposed to send an mail with the local smtp?

Preferential answered 16/5, 2012 at 19:1 Comment(1)
Try github.com/kennethreitz/inbox.pyDemocratize
I
12

As stated on the docs: https://docs.djangoproject.com/en/dev/topics/email/?from=olddocs you need to:

  • On your settings.py define the following:

    EMAIL_HOST = 'localhost' EMAIL_PORT = 1025

  • Then, in another shell run the following command:

    python -m smtpd -n -c DebuggingServer localhost:1025

That will run a dummy SMTP server, that actually will not send any email but you'll be able to see the output and check if that's correct. If you want to actually send your emails during development, you will need to install a SMTP server like sendmail and use that in your configuration.

Irick answered 16/5, 2012 at 20:37 Comment(0)
H
0

I've found this to be a simple and easy solution for development environment. This will just print the email on the console:

Set the following variable in your environment

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
Huygens answered 21/10, 2023 at 13:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.