[英]Gmail API - Get sender name
I want to get the string that the user entered as his sender name when sending emails. 我想获取用户在发送电子邮件时输入的字符串作为其发件人名称。 I can get this from the message API, however it changes sometimes when eg the user sends an email through a service like Google Slides. 我可以从消息API中获得此消息,但是有时,例如当用户通过Google幻灯片之类的服务发送电子邮件时,它有时会更改。 I need the value the user entered manually when he set up his account. 我需要用户设置帐户时手动输入的值。 What is the best way to get this value? 获得此价值的最佳方法是什么?
You need to use another API endpoint. 您需要使用另一个API端点。 You need to send GET request to this url: https://www.googleapis.com/gmail/v1/users/MAIN_EMAIL_OF_USER/settings/sendAs/EMAIL_THAT_WILL_BE_USED_FOR_SENDING 您需要将GET请求发送到以下网址: https : //www.googleapis.com/gmail/v1/users/MAIN_EMAIL_OF_USER/settings/sendAs/EMAIL_THAT_WILL_BE_USED_FOR_SENDING
If you use python library provided by google you can use this endpoint: 如果您使用Google提供的python库,则可以使用以下端点:
service.users().settings().sendAs().get(userId='MAIN_EMAIL_OF_USER', sendAsEmail='EMAIL_THAT_WILL_BE_USED_FOR_SENDING')
More about sendAs
user settings in Gmail API you can find here: https://developers.google.com/gmail/api/v1/reference/users/settings/sendAs 有关Gmail API中sendAs
用户设置的更多信息,请sendAs
以下网址 : https : //developers.google.com/gmail/api/v1/reference/users/settings/sendAs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.