How to put an attachment on the email

22 views
Skip to first unread message

Ryuya

unread,
Mar 7, 2023, 8:56:25 AM3/7/23
to Google Apps Script Community
Hi,

I would like to put an attachment on the email and did the below coding.
However, each time I tried to run, the following error happened.

Can you advise me on this?

Thanks.

スクリーンショット 2023-03-07 22.53.42.png

スクリーンショット 2023-03-07 22.55.24.png

Ed Sambuco

unread,
Mar 7, 2023, 4:13:39 PM3/7/23
to google-apps-sc...@googlegroups.com
Just say

let attachmentFile = DriveApp.getFileById(fileid);  // after setting fileid, which for a file is unique across all folders.
sendmail uses a fourth parameter called object for special settings, including attachments.  Refer to the documentation for setup as a Javascirpt object.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/497db3bb-6924-48f8-b11b-5e1db7391de1n%40googlegroups.com.

Ryuya Sakurai

unread,
Mar 8, 2023, 4:45:51 PM3/8/23
to google-apps-sc...@googlegroups.com
Hi, 

Thank you for the advice.
Noted on that.

2023年3月8日(水) 6:13 Ed Sambuco <esamb...@gmail.com>:
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/rLe_fzZprYA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAANZsGOm0UQpATRaJSxSY32yh7oo5A-xaDEknkPk7b0S6xMc4w%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages