This is the legacy documentation for Google Ads scripts. Go to the current docs.


Send a simple email

function sendSimpleTextEmail() {
                    'TPS reports',
                    'Where are the TPS reports?');

Send email with attachments

function sendEmailWithAttachments() {
  var fileId = '0B41tKrRQJmxeQXlsQUVkMzNxN28';
  // Send an email with two attachments: a file from Google Drive (as a PDF)
  // and an HTML file.
  var file = DriveApp.getFileById(fileId);
  var blob = Utilities.newBlob('Insert any HTML content here', 'text/html',
  MailApp.sendEmail('INSERT_EMAIL_HERE', 'Attachment example',
                    'Two files are attached.',
                        name: 'Automatic Emailer Script',
                        attachments: [file.getAs(MimeType.PDF), blob]

Send HTML email with images

function sendHtmlEmailWithInlineImage() {
  var googleLogoUrl =
  var youtubeLogoUrl =
  var googleLogoBlob = UrlFetchApp
  var youtubeLogoBlob = UrlFetchApp
    subject: 'Logos',
    htmlBody: "inline Google Logo<img src='cid:googleLogo'> images! <br>" +
              "inline YouTube Logo <img src='cid:youtubeLogo'>",
        googleLogo: googleLogoBlob,
        youtubeLogo: youtubeLogoBlob