简体   繁体   English

Google Apps脚本不允许我发送外发电子邮件

[英]Google Apps Script will not allow me to send outgoing e-mails

This simple script should send an e-mail to the prescribed e-mail address ; 这个简单的脚本应该将电子邮件发送到指定的电子邮件地址。 however, it only works if the emailAddress I used is my logged in gmail account. 但是,仅当我使用的emailAddress是我已登录的Gmail帐户时,它才有效。 If I change that e-mail address to anything other than the e-mail address that I am currently logged in as, like my other msn/gmail accounts, it fails. 如果我将该电子邮件地址更改为除我当前登录的电子邮件地址以外的其他任何地址,例如我的其他msn / gmail帐户,则它将失败。 The tutorials given seem to demonstrate that you can send e-mails to anyone. 给出的教程似乎证明了您可以向任何人发送电子邮件。

My code: 我的代码:

function sendEmails() {
    var subject = "Homework Update"
    var messageBody= "testing the message";
    var emailAddress = "example1@gmail.com";
    MailApp.sendEmail(emailAddress,subject,messageBody);
}

Error Message: "Failed to send email to example@gmail.com (line 7, file "Code")Dismiss" 错误消息:“无法发送电子邮件到example@gmail.com(第7行,文件“代码”)关闭”

I tried running the script while logged in with a different e-mail account and the script worked fine. 我尝试使用其他电子邮件帐户登录时运行脚本,但脚本运行正常。 I investigated further and found that my domain administrator does not have mail enabled for our google accounts. 我进行了进一步调查,发现我的域管理员没有为我们的Google帐户启用邮件。 I work at a school and we use Microsoft Exchange server for e-mail. 我在学校工作,我们使用Microsoft Exchange服务器发送电子邮件。 I will be contacting the IT department tomorrow to see if there is anyway I can get the mail application enabled for scripting. 明天我将与IT部门联系,以查看是否可以使邮件应用程序启用脚本功能。 Hopefully this post will help anyone with a similar problem. 希望这篇文章能对任何有类似问题的人有所帮助。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM