Creating e-mail messages
There are two Google services available to send e-mails: Gmail app and MailApp. The latter has only methods to send e-mails, while we have seen that Gmail app can do much more! When simply sending a message, we can use either of them interchangeably; I used to type MailApp more frequently but it is nothing more than a personal habit.
The basic process is really simple as described in the documentation (example taken from Google documentation page):
// Send an email with a file from Google Drive attached as a PDF. var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); GmailApp.sendEmail('mike@example.com', 'Attachment example', 'Please see the attached file.', { attachments: [file.getAs(MimeType.PDF)], name: 'Automatic Emailer Script' });
In the optional parameters, you can use some interesting values as follows:
Attachments: These are an array of blobs (a blob is a data-interchange object for Apps Script services: https://developers.google...