Gmail API无法将任何邮件发布到发布/订阅平台

时间:2019-11-21 08:23:06

标签: google-cloud-platform gmail-api google-cloud-pubsub

我已在GCP中设置了所有内容。在手动发布消息之后,服务器可以接收到该消息。 enter image description here 但是问题是:当我向电子邮件帐户发送电子邮件时,Pub-Sub系统中没有任何通知,并且我的Webhook服务器已断开!

下图是我手动发布消息后服务器可以接收到消息的证明。

enter image description here

enter image description here

enter image description here

enter image description here

并且如上图所示,当我调用列表历史记录API时,我可以检查是否有我刚刚发送的测试邮件信息。

此外,我已经成功调用了********************************************************** schema >>> dbo table >>> stores ===================================================== rs1 >>> tempdb rs2 >>> dbo rs3 >>> stores rs4 >>> null rs5 >>> null rs6 >>> null rsmd >>> 13 INDEX_NAME >>> null INDEX_QUALIFIER >>> null NON_UNIQUE >>> false TYPE >>> 0 ORDINAL_POSITION >>> null COLUMN_NAME >>> null ASC_OR_DESC >>> null FILTER_CONDITION >>> null TABLE_SCHEM >>> dbo TABLE_CAT >>> tempdb ===================================================== ===================================================== rs1 >>> tempdb rs2 >>> dbo rs3 >>> stores rs4 >>> 0 rs5 >>> stores rs6 >>> PK__stores__A2F2A30C0F20F60B rsmd >>> 13 INDEX_NAME >>> PK__stores__A2F2A30C0F20F60B INDEX_QUALIFIER >>> stores NON_UNIQUE >>> false TYPE >>> 1 ORDINAL_POSITION >>> 1 COLUMN_NAME >>> store_id ASC_OR_DESC >>> A FILTER_CONDITION >>> null TABLE_SCHEM >>> dbo TABLE_CAT >>> tempdb ===================================================== ********************************************************** schema >>> dbo table >>> staffs ===================================================== rs1 >>> tempdb rs2 >>> dbo rs3 >>> staffs rs4 >>> null rs5 >>> null rs6 >>> null rsmd >>> 13 INDEX_NAME >>> null INDEX_QUALIFIER >>> null NON_UNIQUE >>> false TYPE >>> 0 ORDINAL_POSITION >>> null COLUMN_NAME >>> null ASC_OR_DESC >>> null FILTER_CONDITION >>> null TABLE_SCHEM >>> dbo TABLE_CAT >>> tempdb ===================================================== ===================================================== rs1 >>> tempdb rs2 >>> dbo rs3 >>> staffs rs4 >>> 0 rs5 >>> staffs rs6 >>> PK__staffs__1963DD9CCB589A48 rsmd >>> 13 INDEX_NAME >>> PK__staffs__1963DD9CCB589A48 INDEX_QUALIFIER >>> staffs NON_UNIQUE >>> false TYPE >>> 1 ORDINAL_POSITION >>> 1 COLUMN_NAME >>> staff_id ASC_OR_DESC >>> A FILTER_CONDITION >>> null TABLE_SCHEM >>> dbo TABLE_CAT >>> tempdb ===================================================== ===================================================== rs1 >>> tempdb rs2 >>> dbo rs3 >>> staffs rs4 >>> 0 rs5 >>> staffs rs6 >>> UQ__staffs__AB6E6164E6F8EDB6 rsmd >>> 13 INDEX_NAME >>> UQ__staffs__AB6E6164E6F8EDB6 INDEX_QUALIFIER >>> staffs NON_UNIQUE >>> false TYPE >>> 3 ORDINAL_POSITION >>> 1 COLUMN_NAME >>> email ASC_OR_DESC >>> A FILTER_CONDITION >>> null TABLE_SCHEM >>> dbo TABLE_CAT >>> tempdb ===================================================== API,它返回了:

watch

这是我的监视电话:

{'historyId': '7688', 'expiration': '1574928158379'}

1 个答案:

答案 0 :(得分:0)

set_watch调用返回一个200和一个带有有效HistoryId的{​​{1}}的事实使我认为手表已正确设置,问题可能出在在发布/订阅端。

与测试的不同之处在于,您可以使用其中一个帐户来发布主题并触发服务器响应。根据文档here,监视消息是使用Google托管的服务帐户发布的:

  

Cloud Pub / Sub要求您授予Gmail特权才能发布   主题相关通知。

     

为此,您需要向授予发布权限   gmail-api-push@system.gserviceaccount.com。您可以使用   之后的Cloud Pub / Sub Developer Console权限界面   资源级访问控制说明。

链接指向herehere的位置。遵循最小特权原则,我建议授予资源(主题)级别的权限。

注意:

面板中的设置如下所示: enter image description here