我在使用Users.drafts:send API的新Gmail UI更新中遇到了奇怪的行为。
(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发送大型附件,这就是使用多部分的原因。
当我在新的 Gmail 界面中使用 API 并将电子邮件发送给自己时,我无法检索电子邮件。它显示在我的收件箱中,但是当我单击该消息时,我收到一条错误消息,指出"无法加载您请求的对话"。但是,当我切换回旧的Gmail界面时,检索邮件没有问题。该 API 在向其他收件人发送电子邮件时有效。
我已经在OAuth 2.0操场和Gmail API站点中尝试过这个,通过向自己发送电子邮件来隔离发送API。我收到 200 响应,API 已成功发送电子邮件。但是,当我转到新的GmailUI与旧的GmailUI时,也会发生同样的事情。
我们正在铬扩展中进行开发。
我不知道为什么会这样。我希望有人能向我解释这一点。
谢谢你的帮助。
我们想出了问题。 当您发送新电子邮件时,不要只添加草稿 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"}
}