Sending Emails with Django
Sending Emails with Django is pretty straightforward. 1st, you need to have a local SMTP(Simple Mail Transfer Protocol) server, or you need to define the configuration of an external SMTP server by adding the following settings to the settings.py file of your project: EMAIL_HOST: The SMTP server host; the default is localhost . EMAIL_PORT: The SMTP port; the default is 25 . EMAIL_HOST_USER: The username for the SMTP server. EMAIL_HOST_PASSWORD: The password for the SMTP server. EMAIL_USE_TLS: Whether to use a TLS(Transport Layer Security) secure connection. EMAIL_USE_SSL: Whether to use an implicit TLS secure connection. If we can not use an SMTP server, we can tell Django to write emails to the console by adding the following setting to the settings.py file EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' By using this setting, Django will output all emails to the shell. This is very useful for testing your application without an SMTP server. If we want t...