我有一个奇怪的行为与新的Gmail用户界面更新的Users.drafts: send API。
(https://developers.google.com/gmail/api/v1/reference/users/drafts/send)
https://www.googleapis.com/upload/gmail/v1/users/me/drafts/send?uploadType=multipart
在调用API时,我确实提供了有效负载。
示例:
--foobar
Content-Type: application/json; charset=UTF-8
{
"id":"r7236859678058445300","message": {"threadId":"1638e05ec3ad551b"}
}
-- foobar
Content-Type: message/rfc822
MIME-Version: 1.0
Date: Wed, 23 May 2018 13:22:22 -0400
Message-ID: <CAEygFSf=hnH-dTUeXDC3Z0FKDLB_C94ej4FNK-
6NO6yOeGRpJA@mail.gmail.com>
Subject: Test
From: Tom <Tom@testemail.com>
To: Tom <Tom@testemail.com>
Content-Type: multipart/alternative; boundary="00000000000028c4a8056ce2c7eb"
--00000000000028c4a8056ce2c7eb
Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes
dsfsdfsdf
--00000000000028c4a8056ce2c7eb
Content-Type: text/html; charset="UTF-8"
<div dir="ltr">dsfsdfsdf</div>
--00000000000028c4a8056ce2c7eb--
-- foobar --我们还尝试在原始https://www.googleapis.com/upload/gmail/v1/users/me/drafts/send?format=raw中使用draft.send
这对我们是有效的,但是,我们不能使用这个URL发送大的附件,这就是为什么使用multipart。
当我在新的Gmail UI中使用API并将电子邮件发送给自己时,我无法检索电子邮件消息。它显示在我的收件箱中,但当我点击消息时,我得到一个错误消息,“您请求的对话无法加载”。但是,当我切换回旧的Gmail UI时,检索消息没有任何问题。该API在向其他收件人发送电子邮件时起作用。
我在Gmail API站点和OAuth 2.0游乐场中尝试过,通过向我自己发送电子邮件来隔离send API。我收到200响应,API已成功发送电子邮件。但是,当我转到新的Gmail UI与旧的Gmail UI时,同样的事情也会发生。
我们正在进行chrome扩展的开发。
我不知道为什么会发生这种事。我希望有人能给我解释一下。
谢谢你的帮助。
发布于 2018-06-18 21:28:56
我们找出了问题所在。当您发送新的电子邮件时,不要添加线程Id,只添加草稿Id。
--foobar
Content-Type: application/json; charset=UTF-8
{
"id":"r7236859678058445300"
}回复或转发电子邮件时,您需要添加线程Id
--foobar
Content-Type: application/json; charset=UTF-8
{
"id":"r7236859678058445300","message": {"threadId":"1638e05ec3ad551b"}
}https://stackoverflow.com/questions/50417138
复制相似问题