John
John

Reputation: 4038

How to display the name of sender instead of email address when sending email using google.appengine.api.mail.send_mail

This is how I send email:

google.appengine.api.mail.send_mail(sender, to, subject, body, make_sync_call=MakeSyncCall, **kw)

source: send mail

However, sender is always sender = '[email protected]', Therefore, when a receiver receives email, it will be like this:

enter image description here

I would like it shows the name of the person who sent email, for example: John Smith.

How can I do it?

Upvotes: 1

Views: 116

Answers (1)

I have run some tests, and based on this documentation, you just need to follow the same structure for the parameter sender as it is in the parameter to, as in the following example:

mail.send_mail(sender="Sender Jackson <[email protected]>",
               to="Albert Johnson <[email protected]>",
               subject="Your account has been approved",
               body="""Your email body""")

The receiver will in their in box an email sent by "Sender Jackson", instead of just the part preceding the@.

Upvotes: 1

Related Questions