Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send email as alias using Django

Background:

I have a site I'm building using Django and I've encountered the following conundrum. I have a backend email that we will call [email protected]. Now I also have a domain email that forwards directly to [email protected] which is called [email protected].

Currently I have my Django Email setting set up as follows:

EMAIL_HOST_USER="[email protected]"
EMAIL_HOST_PASSWORD="password"

This works fine, but I want to have the email sent out from '[email protected]'.

Note:

Including the Python community as a whole as maybe the issue can be resolved outside of Django mail wrapper functions.

Question:

How can I set up this redirection? Meaning, how can I send out emails under the alias '[email protected]' when my true email configured in the Django backend is [email protected] ?

like image 645
Buck Avatar asked Oct 28 '25 18:10

Buck


1 Answers

settings.EMAIL_HOST_USER is only used to authenticate with the SMTP server. The third argument of django.core.mail.send_mail() is the From: address.

like image 159
Ignacio Vazquez-Abrams Avatar answered Oct 31 '25 08:10

Ignacio Vazquez-Abrams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!