我正在尝试使用google MailApp Api发送电子邮件,这是我到目前为止所做的:
function myEmailer(mySubject,imgKey) {
var toEmail ='example@example.com';
MailApp.sendEmail({
to: toEmail,
subject: mySubject,
attachments:DriveApp.getFileById(imgKey)//this should attach an image from my google drive
});
}
我收到的电子邮件很好,但我没有收到附件。
关于我在这里缺少什么的想法?
答案 0 :(得分:0)
你确定你的身份证是正确的吗?
请尝试以下测试:
function test(){
var mySubject = 'test';
var imgKey = '0B3qSFd3iikE3Z1ZWcmlWQTFvWDQ'
myEmailer(mySubject,imgKey)
}
function myEmailer(mySubject,imgKey) {
var toEmail = Session.getActiveUser().getEmail();
MailApp.sendEmail({
to: toEmail,
subject: mySubject,
attachments:DriveApp.getFileById(imgKey).getBlob()//this should attach an image from my google drive
});
}