简体   繁体   中英

to send email with different 'from' email address using gmail smtp server in django

I want to send an email to users with different from field values using smtp gmail server from the django app . I am able to send the mail successfully to users but the from field does not take the value that I provide in send_mail() but instead takes the EMAIL_HOST_USER value defined in settings.py

From field value should take any domain email address ie

  a mail from: xyz@yahoo.co.in or .com 
     or  from: abc@hotmail.com 
     or  so on 

How can I achieve this behavior? Please help. I am new to using django and email functionality.

You cannot forge an email using Google's SMTP server. They will keep on using the current user's information (the login credentials you supplied). If you want to "change"/forge the email header, use your own email server/SMTP

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM