使用gmail api发送对现有邮件的回复不会在Gmail邮箱中显示对话跟踪

时间:2016-02-11 13:24:58

标签: python email gmail-api

我正在使用Python使用gmail rest api。我使用python内置电子邮件库以下列方式构造消息。

message=email.mime.multipart.MIMEMultipart('alternative')
message['from'] = 'Satish <satish@gmail.com>'
message['to'] = 'Satish1 <satish1@gmail.com>'
message['subject'] = 'Same as reply to message's subject'
raw_message = {'raw': base64.urlsafe_b64encode(message.as_string())}
if reply_to:
    raw_message['threadId'] = reply_to  # thread id of existing conversation
return raw_message


我使用Gmail Rest Api发送此邮件,如下所示:

users().messages().send(userId='me', body=raw_message).execute()

我正在收到此消息作为该主题的一部分,这很好。但无法看到附加到邮件的会话跟踪。
[会话跟踪与消息相关联的内容为 ... ,当悬停时会显示显示修剪内容]


对此有任何帮助表示赞赏。

先谢谢

1 个答案:

答案 0 :(得分:1)

这条路径只是信息的一部分。 Gmail API不会为您实现该功能。您可以只收到要回复的邮件,并将其放在邮件下方,每个引用行的起始>

MIME-Version: 1.0
Received: by 10.194.176.73 with HTTP; Thu, 11 Feb 2016 07:48:48 -0800 (PST)
In-Reply-To: <CADsZLRyvpU3bVw4MmmqGKTr=4bAAQmrRKj3gABVBWqrr8peoUA@mail.gmail.com>
References: <CADsZLRyvpU3bVw4MmmqGKTr=4bAAQmrRKj3gABVBWqrr8peoUA@mail.gmail.com>
Date: Thu, 11 Feb 2016 16:48:48 +0100
Delivered-To: emtholin@gmail.com
Message-ID: <CADsZLRztKLR0GgUSZxN6+B4pwxZiFi=6Rexq+kBXTYWy1UnojQ@mail.gmail.com>
Subject: Re: Hello my friend
From: Emil Tholin <emtholin@gmail.com>
To: Emil Tholin <emtholin@gmail.com>
Content-Type: multipart/alternative; boundary=001a1130d08c848a3e052b807cea

--001a1130d08c848a3e052b807cea
Content-Type: text/plain; charset=UTF-8

Likewise buddy.

2016-02-11 16:48 GMT+01:00 Emil Tholin <emtholin@gmail.com>:

> Nice to meet you.
>

--001a1130d08c848a3e052b807cea
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Likewise buddy.</div><div class=3D"gmail_extra"><br><div c=
lass=3D"gmail_quote">2016-02-11 16:48 GMT+01:00 Emil Tholin <span dir=3D"lt=
r">&lt;<a href=3D"mailto:emtholin@gmail.com" target=3D"_blank">emtholin@gma=
il.com</a>&gt;</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin=
:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">N=
ice to meet you.</div>
</blockquote></div><br></div>

--001a1130d08c848a3e052b807cea--