Google apps script 谷歌应用程序脚本-MailApp

Google apps script 谷歌应用程序脚本-MailApp,google-apps-script,Google Apps Script,我想用Google Apps脚本发送一封包含replyTo和附件的电子邮件,但我只找到了这两种方法,它们分别满足了我的要求 sendEmail(recipient, subject, body, options) sendEmail(to, replyTo, subject, body) 还有一种方法我可以同时做到这两个方面?你最好的选择是使用第一种方法 sendEmail(recipient, subject, body, options) 此方法可以获取所有参数。在选项部分传递所

我想用Google Apps脚本发送一封包含replyTo和附件的电子邮件,但我只找到了这两种方法,它们分别满足了我的要求

sendEmail(recipient, subject, body, options)

sendEmail(to, replyTo, subject, body)   

还有一种方法我可以同时做到这两个方面?

你最好的选择是使用第一种方法

sendEmail(recipient, subject, body, options)
此方法可以获取所有参数。在选项部分传递所有参数

它看起来像这样

// Send an email with two attachments:
//   a file from Google Drive (as a PDF) and an HTML file.
var file = DriveApp.getFileById('12345mnopqrstuvwxyz');
var blob = Utilities.newBlob('HTML content here',
                             'text/html',
                             'my_email.html');

MailApp.sendEmail('mike@example.com',
                  'Attachment example',
                  'Two files are attached.',
                  {
                    attachments: [file.getAs(MimeType.PDF), blob],
                    replyTo: 'ReplyTo@Email.com'
                  });
下面是文档的屏幕截图