Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9178091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:28:18+00:00 2026-06-17T17:28:18+00:00

Getting Django to send an email is nicely explained here using standard settings as

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:28:19+00:00Added an answer on June 17, 2026 at 5:28 pm

    If you want to override the provided settings you can just create your own connection and provide it to send_email or EmailMessage

    from django.core.mail import get_connection, send_mail
    from django.core.mail.message import EmailMessage
    # TODO: Insert clever settings mechanism
    my_host = ''
    my_port = 587
    my_username = ''
    my_password = ''
    my_use_tls = True
    connection = get_connection(host=my_host, 
                                port=my_port, 
                                username=my_username, 
                                password=my_password, 
                                use_tls=my_use_tls) 
    
    send_mail('diditwork?', 'test message', 'from_email', ['to'], connection=connection)
    # or
    EmailMessage('diditwork?', 'test message', 'from_email', ['to'], connection=connection).send(fail_silently=False)
    

    Update: 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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to send activation email with username by using django-registration .I've configured Amazon SES
I am using django-ses to send e-mail using AWS Simple E-mail Service. I have
I am getting a import error in django. My main urls.py settings file is
I keep getting this error when using django templates in Google App Engine: TemplateSyntaxError:
I've been getting these errors intermittently from sending email from my django app. I
I use django backend to send email (but really django is irrevelant in this
I having issues getting Django to work with settings.py at different location I have
using django 1.4 im getting a 403 error when i try to do a
I want to send a mail to users that fill the email field in
I have a django template which I have to send as email body, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.