问题标签 [gmail-api]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
17777 浏览

gmail-api - How do I send email using gmail api php

How do I send email using gmail api php

currently i am using $message = $service->users_messages->send('me', $msg);

Where to difine to,subject ?

0 投票
1 回答
79 浏览

google-apps-script - 根据线程中最后一条消息的年龄归档线程

我正在使用 Google Apps 脚本来归档收件箱中标记为“跟进”的所有电子邮件。

这行得通 - 但我有一个问题。

线程(对话)是根据线程中的第一封/最旧的电子邮件存档的 - 而我需要根据线程中的最后一封/最新的电子邮件对其进行存档。我基本上想要的是 - “如果 4 天没有回复线程 - 存档它”。

这样做的正确方法是什么?

0 投票
1 回答
101 浏览

c# - 在 Windows 应用程序上获取 Gmail 用户凭据的用户友好方法

我正在使用 .Net3.5 编写一个 Windows C#.Net 应用程序。我正在尝试使用 Google 的Gmail API(要求)从 Gmail 下载电子邮件。是否可以以用户友好的方式获取用户凭据(浏览器页面弹出请求凭据,直接向我的应用程序提供用户名和密码,或其他方式),而不是让用户自己获取凭据

0 投票
3 回答
1270 浏览

c# - 带有 .Net 客户端库的 Gmail api:缺少草稿消息 [400]

我正在尝试使用 .Net 客户端库在 Gmail 中创建草稿。我可以成功登录并检索草稿列表,因此身份验证和 api 正在工作。现在我需要创建 Draft 类的实例并将其发送到 API。但是消息草稿需要是什么样的呢?我在https://developers.google.com/gmail/api/v1/reference/users/drafts/create上填写 API 浏览器并不重要,我的草稿总是空的。此外,当从我的 C# 代码执行此操作时,我需要将 draft.Message.Raw 字段设置为其他内容,我收到错误消息:

0 投票
2 回答
9412 浏览

request - Gmail API 所有邮件

我需要使用 gmail api 获取收件箱中的所有邮件。但我只看到一种方法。

  1. 获取消息列表(id,threadID

    /li>
  2. 使用 id 获取循环中的所有消息

    /li>

但是这种方式需要 100500 请求。有人知道如何通过一个请求获取所有消息(或只是有效负载字段)吗?

0 投票
3 回答
5010 浏览

javascript - 从 gmail api 发送电子邮件未收到但显示在已发送文件夹中

我正在使用 gapi 发送 gmail。但是,如果我将邮件发送给自己,它不会出现在我的收件箱中。最奇怪的是,它出现在“已发送”文件夹中。`

` 控制台登录信息为:

我可以在 Gmail 的“已发送”文件夹中看到这封邮件,但我没有在收件箱中收到它。此邮件在“已发送”文件夹中的原件如下:

有人知道为什么吗?非常感谢!

编辑:我将 Mime 消息中的“收件人:”更改为另一个邮箱(不是 Gmail),并正确接收邮件。感觉更迷茫了。

编辑:我添加了一个“抄送”:字段,它是:znlswd@gmail.com(myself)、71848140@qq.com、swdpal2014@gmail.com、ezdiary@163.com。所有其他人(Gmail 和其他邮箱)都收到了邮件,但我仍然无法收到自己的邮件。

我在ezdiary@163.com收到的原始邮件如下:

编辑: swdpal2014@gmail.com 中的原始邮件如下:

0 投票
4 回答
16671 浏览

android - 如何从我的 Android 应用程序访问新的 Gmail API?

我正在尝试从我的 Android 应用程序访问新的Gmail API(2014 年 6 月 25 日宣布),以便返回某个用户帐户中的所有电子邮件。我正在使用 ADT 插件在 Eclipse 中开发应用程序。
到目前为止我做了什么:

  • 我在 Google Developers Console 中注册了该应用程序
    (链接:console.developers.google.com/project)。

  • 我已经实现了 Google+ 登录按钮(链接:developers.google.com /+/mobile/android/sign-in )。Google+ 登录按钮可对用户进行身份验证并管理 OAuth 2.0 流程,从而简化您与 Google API 的集成。

  • 我将附加范围“https://www.googleapis.com/auth/gmail.readonly”添加到 Google+ 授权中,用于访问 Gmail API,如
    (链接:developers.google.com/gmail/api/v1 /reference/users/threads/list)。

此时我有一个初始化的 GoogleApiClient 对象。

GoogleApiClient 对象将 ServiceConnection(链接:developer.android.com/reference/android/content/ServiceConnection.html)包装到 Google Play 服务。GoogleApiClient 对象用于与 Google+ API 通信,并在与服务建立异步连接后生效,表明:

  • 设备上正在运行 Google Play 服务,并且应用 Activity 已成功绑定服务连接,
  • 用户选择了他们希望在应用程序中使用的帐户,并且
  • 用户的帐户已授予应用程序请求的权限。



我如何从这里开始使用这个httprequest获取所有消息?
此时我尝试访问 Gmail API,但收到身份验证错误 401:需要登录,即使 Google+ 登录成功,我也成功返回了用户圈子列表。

编辑:SecondActivity.java

编辑 2:LogCat

0 投票
2 回答
2022 浏览

javascript - 使用 gmail api 和 javascript 设置发件人姓名?

我正在使用 Gmail API 发送电子邮件。电子邮件已正确发送,但未显示发件人地址,因为我提到了 "Anup S via TestApp" 。相反,它只是显示用户 ID/电子邮件。

有想法该怎么解决这个吗?

0 投票
1 回答
341 浏览

.net - Gmail API Performance and Errors

I have recently started using the Gmail API as opposed to IMAP. I am using the .Net client library for calling the API.

On a random basis I am recieving the Error

"An error occurred while sending the request" when executing a Get Request of a Message

My observations are that this is a random error that occurs now and then. I can run 10 Requests and then there will be a fail. I am running the same request on the same infrastructure each time.

I have also noted that the performance is not very consistent - it can sometimes take 10 seconds and other times sub-second.

Is anybody else experiencing issues such as this?

Thanks for your help,

UPDATE

I am calling the same message and it is a small one with no attachments. I have a load tester that requests it 100 times. The errors are to do with the closing of an underlying connection. I am going to try a different web host to see if that is a factor. Here are the full error messages:

Error on Message Get

|System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) --- End of inner exception stack trace --- at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)

Error during authentication

|System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) --- End of inner exception stack trace --- at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) --- End of inner exception stack trace --- at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task) at Google.Apis.Auth.OAuth2.ServiceAccountCredential.d__b.MoveNext()

Paul C

0 投票
1 回答
2642 浏览

python - B64 解码问题

使用非 mime message.get 方法,我拉出正文/数据并尝试对其进行解码,以便简单地以英文显示消息。我遇到的问题是某些消息可以正常解码,然后突然出现错误的填充问题。我尝试替换 + 和 / 无济于事。

为什么会发生这种情况,我该如何解决?

这是我的 messages.get 方法:

更新

服务

回溯错误

使用 urlsafe 时出现回溯错误