标签: gmail-api

如何解码电子邮件的内容?

我收到一封电子邮件:

\n\n
Dear xxx,\n\nThank you. You have just ordered the ultimate treat for your taste buds.\n\nYour yummy, lip smacking delight is being prepared with utmost love and attention at your own neighbouring Pizza Hut \xe2\x80\x93 Bengaluru - Airport Road....\n
Run Code Online (Sandbox Code Playgroud)\n\n

但是当我说“显示原始内容”时,它显示为:

\n\n
MIME-Version: 1.0\nSender: noreply@pizzahut.co.in\nFrom: noreply@pizzahut.co.in\nTo: xxx@gmail.com\nReply-To: noreply@pizzahut.co.in\nDate: 19 Sep 2014 19:44:26 +0530\nSubject: PHD: Your order confirmation\nContent-Type: text/html; charset=utf-8\nContent-Transfer-Encoding: base64\nX-AntiAbuse: This header was added to track abuse, please include it with any abuse report\nX-AntiAbuse: Primary Hostname - server.pizzahut.co.in\nX-AntiAbuse: Original Domain …
Run Code Online (Sandbox Code Playgroud)

email gmail gmail-api

4
推荐指数
1
解决办法
9504
查看次数

为 Gmail 预设回复创建快捷方式

我目前正在使用 Gmail 实验室功能 - 预设回复。 我有很多这样的预设回复,并使用他们的菜单找到正确的回复,事实证明这很耗时。通过以下方式找到预设响应会更容易:

  1. 将预设响应链接到关键字
  2. 在正文或主题字段中使用该关键字。像这样的东西。

这是否可以通过使用Gmail API来实现,或者您是否会建议另一种方法来做到这一点?

email gmail email-templates gmail-api

4
推荐指数
1
解决办法
3018
查看次数

使用 Gmail API 搜索参数

我正在使用 gmail API 来搜索消息。我想包含一些搜索参数,但我不知道如何使用多个搜索参数。我想做 old_than 和 -unsubscribe

$(document).ready(function() {
    var submitButton = 0;

  function randomPicture (){
    min = Math.ceil(1);
    max = Math.floor(14);
    var pictureNumber = Math.floor(Math.random() * (max - min)) + min;
    $('.sidetext').css('background-image', 'url(images/pic'+pictureNumber+'.jpg)');
    console.log(pictureNumber);
  }

    $('#submit').click(function(){
      randomPicture();
      var searchTerm = $('#input-person').val();
      listMessages('me', searchTerm, listMessageCallback);
       submitButton = submitButton + 1;
     $('.quote').remove();  

    });

    function listMessages(userId, query, callback) {
      $('#content').css('left', $('sidetext'.offsetLeft));
      var getPageOfMessages = function(request, result) {
          request.execute(function(resp) {
            result = result.concat(resp.messages)
        };

      var initialRequest = gapi.client.gmail.users.messages.list({
        'userId': userId,
        'q': query
      }); …
Run Code Online (Sandbox Code Playgroud)

javascript gmail-api

4
推荐指数
1
解决办法
5711
查看次数

类型错误:无法读取未定义的属性“client_secret”

我正在尝试按照 Google 的 Node API 在此处访问 gmail 。

将他们的示例快速入门作为 运行node quickstart.js时,出现以下错误:

TypeError: Cannot read property 'client_secret' of undefined
    at authorize (/home/user/example/quickstart.js:32:43)
    at processClientSecrets (/home/example/bstick/quickstart.js:21:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:439:3)
Run Code Online (Sandbox Code Playgroud)
  • 我已经下载了密钥并对其进行了重命名client_secret.json,并将其复制到quickstart.js
  • node --version= 7.8.0, package.json 有"google-auth-library": "^0.10.0", "googleapis": "^19.0.0"

源代码(谷歌的例子):

var fs = require('fs');
var readline = require('readline');
var google = require('googleapis');
var googleAuth = require('google-auth-library');

// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/gmail-nodejs-quickstart.json
var SCOPES …
Run Code Online (Sandbox Code Playgroud)

javascript node.js gmail-api

4
推荐指数
2
解决办法
4077
查看次数

Google Gmail API 定价

我在使用 client_secret.json 文件的 .Net 项目中使用 Gmail API。

那是完全免费的,还是我们需要为使用 Gmail API 支付任何费用?

还有 client_secret.json 的有效期是多久?文件有没有过期?

.net c# gmail-api

4
推荐指数
2
解决办法
1万
查看次数

使用 Google Apps 脚本自动移动/应用标签到 Gmail

我正在尝试为我的 G Suite 邮箱制作一个自动归档脚本。

该脚本包含一个搜索查询,然后应该获取所有找到的结果,从收件箱中删除并向其添加自定义标签(存档)。

我正在努力解决这个问题addLabel。它抛出一个错误,InternalError: Cannot find method addLabel(string).但是当我检查文档时,它似乎是正确对象上的正确方法。

任何帮助,将不胜感激。

自动 Gmail 归档

var ARCHIVE_LABEL = "archived";    
var AUTO_ARCHIVE_AFTER = "30";

function Intialize() {
  return;
}

function Install() {

  ScriptApp.newTrigger("autoArchive")
           .timeBased()
           .at(new Date((new Date()).getTime() + 1000*60*2))
           .create();

  ScriptApp.newTrigger("autoArchive")
           .timeBased().everyDays(1).create();

}

function Uninstall() {

  var triggers = ScriptApp.getScriptTriggers();
  for (var i=0; i<triggers.length; i++) {
    ScriptApp.deleteTrigger(triggers[i]);
  }

}

function autoArchive() {

  var age = new Date();  
  age.setDate(age.getDate() - AUTO_ARCHIVE_AFTER);

  var auto  = Utilities.formatDate(age, Session.getScriptTimeZone(), "yyyy-MM-dd"); …
Run Code Online (Sandbox Code Playgroud)

gmail google-apps google-apps-script gmail-api google-workspace

4
推荐指数
1
解决办法
1820
查看次数

客户端无权使用此方法检索访问令牌 Gmail API

正如许多其他人所写,我也遇到了这个问题,我在尝试通过 API 设置新的电子邮件签名时遇到了这个问题

确切的 API 调用是:

sendAsConfiguration = {
        'signature': 'Test email signature'
    }
result = gmailService.users().settings().sendAs().patch(userId='xxx@domain.com',
            sendAsEmail="xxx@domain.com",
            body=sendAsConfiguration).execute()
Run Code Online (Sandbox Code Playgroud)

确切的回应是:

google.auth.exceptions.RefreshError: ('unauthorized_client: Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.', '{\n  "error": "unauthorized_client",\n  "error_description": "Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested."\n}')
Run Code Online (Sandbox Code Playgroud)

我的场景如下:

  1. 我正在使用 GCP Cloud Functions 中的 Python
  2. 我管理从相同的代码库和设置向 G Suite 目录管理员发出请求
  3. 我用狂野的委托创建了一个服务帐户。我在代码和 …

gmail-api

4
推荐指数
2
解决办法
6912
查看次数

Google Gmail API - 如何以编程方式登录?

我正在寻找编写一个 PHP 脚本来扫描我的 gmail 收件箱,并阅读未读的电子邮件。不需要用户交互。这必须发生在执行 PHP 文件的 cronjob 上。

这甚至可以通过 API 实现吗?Google 的文档绝对糟糕透了,似乎没有任何示例可以让您以编程方式授权登录。他们总是要求用户在 oauth 请求上物理按下允许按钮。

有没有人尝试过简单地登录并列出您的消息而无需人工交互的经验?

php google-api google-oauth gmail-api

4
推荐指数
1
解决办法
4802
查看次数

Chrome 扩展程序和 gmail.js 阻止访问 google api

我只是在玩基于本教程https://cloud.google.com/blog/products/gcp/deepbreath-preventing-angry-emails-with-machine-learning的 chrome 扩展。

当我出于某种原因使用扩展程序时,我无法使用 gmail.js https://github.com/josteink/gmailjs-node-boilerplate获取草稿电子邮件的正文。

使用 gmail.js 样板,

    "use strict";

console.log("Extension loading...");
const jQuery = require("jquery");
const $ = jQuery;
const GmailFactory = require("gmail-js");
const gmail = new GmailFactory.Gmail($);
window.gmail = gmail;




/*
This code uses the Gmail library to observe emails being sent, turn them into XML,
then return a json data, body, which is put into the request and parsed with ML.
*/

gmail.observe.on("load", () => {
  const userEmail = gmail.get.user_email();
  console.log("Hello, " + …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome-extension gmail-api gmail.js

4
推荐指数
1
解决办法
375
查看次数

4
推荐指数
1
解决办法
7073
查看次数