简体   繁体   English

Gmail API-获取发件人姓名

[英]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.

相关问题 如何在Python Gmail API中更改发件人的名称? - How to change name of Sender in Python Gmail API? 使用 Gmail API 发送邮件时设置发件人姓名和姓氏 - set sender name and last name when sending mail with Gmail API python imaplib获取gmail收件箱主题标题和发件人姓名 - python imaplib to get gmail inbox subjects titles and sender name python 3.x - Gmail api 获取标题和发件人 - python 3.x - Gmail api get title and sender 如何获取电子邮件 gmail python API 的发件人 - How can I get the sender of an email gmail python API Gmail API - 从 g-suite 服务帐户发送邮件时设置发件人名称 - Gmail API - set sender name when sending mail from a g-suite service account 每当我从某个发件人那里收到 email 时,如何让 Gmail API 通知机器人 - How to get the Gmail API to notify a bot whenever I get an email from a certain sender 如何使用 Gmail API 阻止发件人? - How to block a sender using Gmail API? 通过 Python 中的 Gmail API 获取给定日期之间的电子邮件列表(发件人的电子邮件、主题和正文) - Get list of emails (Sender's Email, Subject and Body) between given dates through Gmail API in Python 使用 python 和 Gmail API 从特定发送者的最后一条消息中获取并解析数据 - Get and parse data from the last message of a specific sender with python and Gmail API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM