dousong2967 2018-02-27 06:00
浏览 102

错误400失败前提条件服务器端gmail api php

hi im trying to get a list of my email using gmail api with php but i got error 400, is PHP for Gmail API is still developed or just im doin it wrong ?

$optParams = [];
    $optParams['maxResults'] = 5; // Return Only 5 Messages
    $optParams['labelIds'] = 'INBOX'; // Only show messages in Inbox
    $optParams['q'] = 'from: "abc"'; // Only show messages in Inbox
    $list = $gmail->users_messages->listUsersMessages("my email",$optParams);

btw i'm non g suite and using service account Thanks

--- update ---

Here's my $gmail variable source

 putenv('GOOGLE_APPLICATION_CREDENTIALS='.base_path('service_account.json'));
   $client->useApplicationDefaultCredentials();
    $client->setScopes(\Google_Service_Gmail::MAIL_GOOGLE_COM);
    $client->setAccessType('offline');        // offline access
    $client->setIncludeGrantedScopes(true);   // incremental auth
    $gmail = new \Google_Service_Gmail($client);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?