Background :-
My email Backend is something like this:
EMAIL_HOST ='smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'XXX'
EMAIL_USE_TLS = True
Problem:-
I am using EmailMultiAlternatives to send html mails. Now I want to define auth_user and auth_password so that i can change the "from". Basically I want to over ride the EMAIL_HOST_USER, but want the from_email to be verbose, i.e. 'Support Team'. How can it be done?
subject, from_email, to = "hello", 'Support Team','[email protected]'
text = "hello"
html = "<strong>hello</strong>"
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send(fail_silently=False,auth_user = '[email protected]',auth_password = 'XXX')
You could do something like this: