使用Gmail API发送带签名的电子邮件 [英] Sending email with signature using Gmail API

查看:96
本文介绍了使用Gmail API发送带签名的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我让Gmail Rest API发送部分正常工作,但是电子邮件中没有签名,并且在收件人的收件箱中,发件人"标签是发件人的用户ID,而不是用户名.

I got the Gmail Rest API sending part working but the e-mail doesn't include the signature and in recipient's inbox the 'from' label is sender's user id not the name of the user.

这是在php中.

    $mime = new Mail_mime();
    $mime->setFrom("ABCD");  //This doesn't work....
    $mime->setSubject('Testing');
    $mime->setTXTBody('This is a demo mail');
    $mime->addTo('a@a.com');
    $message_body = $mime->getMessage();
    $encodeMessage = base64url_encode($message_body);
    $message = new Google_Service_Gmail_Message();
    $message->setRaw($encodeMessage);
    $send = $service->users_messages->send('me', $message);

反正有包括签名并更改来源"的信息吗?

Is there anyway to include the signature and change the 'from'?

推荐答案

API不会添加签名,因为它是Web客户端上的设置,而不是整个帐户的全局设置.如果您在Thunderbird,Outlook或其他电子邮件客户端上配置Gmail帐户,则Gmail也不会添加签名.您应该通过两种不同的方式考虑Gmail:

The signature is not added by the API because it is a setting on the web client, not a global setting for the entire account. If you configure your Gmail account on Thunderbird, Outlook or another email client, Gmail will not add the signature either. You should think about Gmail in two separate ways:

  1. 可通过 https://mail.google.com 访问的网络客户端界面,像其他电子邮件客户端一样;
  2. 您的收件箱(邮件最终到达的位置)完全独立于您用来访问邮件的客户端.
  1. The web client interface, accessible at https://mail.google.com, which is just an email client like any other;
  2. Your inbox, the place where messages end up in, which is completely independent of the clients you use to access it.

换句话说,这是一个与电子邮件客户端相关的设置,客户端唯一要做的就是在您自己编写的文本中添加一些文本,

In other words, this is an email client-dependent setting, and the only thing the clients do is add a bit of text to the text you write yourself, nothing else.

这篇关于使用Gmail API发送带签名的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆