使用Postman的GMAILAPP函数调用Google Apps脚本API [不使用Autho2]

发布于 2025-02-14 01:55:06 字数 867 浏览 3 评论 0原文

我正在尝试使用 postman 访问 Google Apps脚本Gmail Service 。 这是我的Google Apps脚本代码,具有直接的SendMail函数:

function sendMail() {
  GmailApp.sendEmail('[email protected]','from inTracck','Test for new API source')
}

如您所见,这是发送简单电子邮件的代码。 在Google Apps脚本中部署项目后,我在邮递员上使用了一个网络应用地址:

Web App Address:
https://script.google.com/macros/s/.../exec

我将其全部放在邮递员身上,这就是我的使用方式:

现在,问题是当我发送 api ,它行不通。 我知道我可能必须填写身体部分,但是由于我不是很技术,所以我不知道如何填充它以使API工作并从邮递员那里发送电子邮件。

I am trying to access the Google Apps Script Gmail service with Postman.
Here is my Google Apps Script Code, with a straightforward sendMail function:

function sendMail() {
  GmailApp.sendEmail('[email protected]','from inTracck','Test for new API source')
}

As you may see, it's a code to send a simple email.
After deploying my project in Google Apps Script, I've got a Web App address to use on my postman:

Web App Address:
https://script.google.com/macros/s/.../exec

I put it all on my Postman, here is how I use it:
Google Apps Script API in Postman

Now, the issue is that when I send the API, it doesn't work.
I know that I might have to fill out the body section, but since I'm not very technical, I didn't know how to fill that to make the API works and send an email from my Postman.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

|煩躁 2025-02-21 01:55:06

您需要一个 doget> doget() 数据:

function doGet(){
  sendMail();// call send email function
  return ContentService.createTextOutput('Email Sent!')
}

您应该使用以下配置发布:

  • 执行为“我”
  • 访问:“任何人”

注:重新发布更改URL。确保在Postman中使用新发布的URL。

You need a doGet() function to return data:

function doGet(){
  sendMail();// call send email function
  return ContentService.createTextOutput('Email Sent!')
}

You should publish it with these configurations:

  • Execute as "Me"
  • Access:"Anyone"

Note: Republishing changes the URL. Make sure to use the newly published URL in Postman.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文