H H H
H H H

Reputation: 529

How to display a name instead of email address with django send_mail?

I want a name to appear instead of an email address when the user receives an email that is sent from django send_mail().

For example:

When an email is sent with the below code the person who receives it sees [email protected] in his inbox. I would like a name to be displayed.

send_mail('subject', 'content', [email protected], ['[email protected]'], fail_silently=False)

Just like when companies send their emails to users, we dont see an email address instead we see the company name.

Upvotes: 5

Views: 3942

Answers (1)

Gonzalo
Gonzalo

Reputation: 4269

Try using a display name:

send_mail('subject', 'content', 'Name <[email protected]>', ['[email protected]'], fail_silently=False)

Upvotes: 22

Related Questions