Sending email ignores "from" header and doesn't display proper Gmail name

50 views
Skip to first unread message

in...@specialcommittee.com

unread,
Sep 19, 2016, 6:44:16 PM9/19/16
to Google API Python Client, John Dempsey
Hi, 

When I am sending emails via python script, no matter what I set the "from" field as, the email shows up as "info".  The email address that I am sending from an "info@***.com" email address, but I want it to show up in the email as from "Special Committee".  This is the name that is associated with the Gmail account and what happens when I send emails from that account normally.

I understand Gmail might be ignoring the 'from' header to prevent spoofing, but is there any way to get the proper gmail name to display when I am sending emails from the API?

excerpt from my Python script.

  message = MIMEText(message_text)
  message['from'] = "me"
  message['to'] = to

  message['subject'] = subject
  print message.as_string()
  return {'raw': base64.urlsafe_b64encode(message.as_string())}


John Asmuth

unread,
Sep 19, 2016, 7:03:49 PM9/19/16
to Google API Python Client, John Dempsey

Try "\"Special Committee\" info@***.com".


--
You received this message because you are subscribed to the Google Groups "Google API Python Client" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-api-python-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

in...@specialcommittee.com

unread,
Sep 20, 2016, 11:39:14 AM9/20/16
to Google API Python Client, jaede...@gmail.com
Nope, tried both "\"Special Committee\" info@***.com" and "\"Special Committee\" <info@***.com>".  

Oddly enough, under Settings > Accounts > Send mail as, it shows "Special Committee".  So, I don't get why the API doesn't use this or if there's a way to set/override that in my python script.
To unsubscribe from this group and stop receiving emails from it, send an email to google-api-python-client+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages