[英]Google Apps Script Web App MailApp/GmailApp.sendMail() not working when parameter is sent using doGet()
function doGet(e) {
var email = e.parameter.method;
var subject = "Hello";
var body = "Hi, I am ";
MailApp.sendEmail(email, subject, body);
Logger.log(e.parameter.method);
}
Above is my Apps Script published as a web app. 上面是我作为网络应用发布的Apps脚本。 Logger is working fine, but the mail is not being sent. 记录器工作正常,但未发送邮件。 I am trying to run the script by browser, going to following link. 我正在尝试通过浏览器运行脚本,请转到以下链接。 I was expecting a mail to be sent to some.body from my mail. 我原本希望将邮件从我的邮件发送给某人。 I have already authorized the script to send my mails. 我已经授权脚本发送我的邮件。
https://script.google.com/macros/s/[---my script--- ]/exec?method=some.body@gmail.com
Put this in a try-catch block to catch the exact error. 将其放在try-catch块中以捕获确切的错误。 You may also want to test for your email quota. 您可能还需要测试您的电子邮件配额。
function doGet(e) {
try {
var email = e.parameter.method;
var subject = "Hello";
var body = "Hi, I am ";
MailApp.sendEmail(email, subject, body);
Logger.log(e.parameter.method);
Logger.log(MailApp.getRemainingDailyQuota());
} catch (error) {
Logger.log(error.toString());
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.