简体   繁体   English

如何使用Cloud Function和Mail API接收,处理和发送电子邮件?

[英]How to receive, process, and send an email using Cloud Function, and Mail API?

I am trying to create a basic application to do the following using GCP: 我正在尝试创建一个基本的应用程序以使用GCP执行以下操作:

  1. Receive an email 收到邮件
  2. Read the email 阅读电子邮件
  3. Process the text in the email body 处理电子邮件正文中的文本
  4. Send the processed text to the original sender as email body 将处理后的文本作为电子邮件正文发送到原始发件人

For example: 例如:

example@example.com sends an email with Subject Process this and Email body Hello to the Google service account . example@example.comGoogle服务帐户发送一封电子邮件,其中包含“主题Process this ,电子邮件正文“ Hello ”。 The python program ( Cloud functions ) will programmatically read the email body as string, append world! python程序( Cloud函数 )将以编程方式将电子邮件正文读取为字符串,追加world! , then send Hello world! ,然后发送Hello world! to the example@example.com as email body with subject Processed! 作为主题的电子邮件正文发送到example@example.com Processed! .

I have added example@example.com to Mail API Authorised Senders . 我已将example@example.com添加到Mail API授权的发件人

I found these GitHub code to send and receive email. 我发现这些GitHub代码可以发送接收电子邮件。

How do I use these in cloud functions to actively look for incoming email and respond with a appropriate email with respect to my process? 如何在云功能中使用这些功能来主动查找传入的电子邮件并针对我的流程以适当的电子邮件进行响应?

As I understand your problem is that you don't know how to trigger you Cloud Function. 据我了解,您的问题是您不知道如何触发云功能。 In this case I would suggest you to read Google's documentation about calling a Cloud Function . 在这种情况下,建议您阅读有关调用Cloud Function的 Google文档。

In your case, you could use this Third Party API . 就您而言,您可以使用此第三方API What this API does is when you receive an e-mail, it sends an HTTP POST request with all the information that are included in the e-mail. 此API的作用是当您收到电子邮件时,它会发送HTTP POST请求以及该电子邮件中包含的所有信息。 This HTTP request will trigger your function. 此HTTP请求将触发您的功能。

Let me know if it was helpful. 让我知道是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Cloud Pubsub 发送电子邮件通知 - How to send email notification using Cloud Pubsub 如何在Outlook中使用python将电子邮件与收件人作为Microsoft邮件发送电子邮件? - How to send email using python in outlook with recipient as microsoft mail? 如何使用python接收邮件 - How to receive mail using python Mandrill API 与收件人(cc)一起发送 email,但它也使用 Django==1.11.10 将邮件作为“TO”发送给收件人(cc) - Mandrill API to send email with recipients(cc), but It also send mail to recipients(cc) as 'TO' using Django==1.11.10 如何使用 Cloud Functions 接收和解析电子邮件? - How to receive and parse email with Cloud Functions? 如何使用Google App Engine邮件API提取电子邮件正文? - How to extract email body using the google app engine mail api? 通过云存储桶更改通过云功能发送邮件 - Send Mail thru cloud function over cloud bucket changes google appengine - 如何配置发送和接收电子邮件 - google appengine - how to configure to send and receive email 如何在没有邮件模板odoo 9的情况下发送电子邮件 - How to send email without mail template odoo 9 django发送和接收电子邮件? - django to send AND receive email?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM