Getting Django to send an email is nicely explained here using standard settings as shown below.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = "mail.mysmtpserver.somewhere" #EMAIL_PORT EMAIL_HOST_USER = "my@login" EMAIL_HOST_PASSWORD = "mypassword" #EMAIL_USE_TLS = True
Then using django.core.mail.EmailMessage to send it of.
How ever, what if you are running multiple sites and need each of these to send email through their own SMTP server (or just different login in the same SMTP server)?
Searching for a EmailBackend like this or a way to do it with the current backend did not produce any satisfactory results.
If you want to override the provided settings you can just create your own connection and provide it to
send_emailorEmailMessageUpdate: Make sure to close the connection after use, @michel.iamit answer points to code showing the connection is cached for smpt. @dhackner answer shows how to automatically close a connection using with statement.