title: Google Apps Script - inline images example doesn't work
body: <p>I'm trying to get this example script working from <a href="https://developers.google.com/apps-script/reference/mail/mail-app#methods" rel="nofollow">this Google Developer page</a>.</p>
  
  <p>I put the below code, which is copy/pasted verbatim (except for the "recipient@example.com" of course) into a function which runs when a form is submitted.</p>
  
  <pre><code>// This code fetches the Google and YouTube logos, inlines them in an email
  // and sends the email
  function inlineImage() {
   var googleLogoUrl = "http://www.google.com/intl/en_com/images/srpr/logo3w.png";
   var youtubeLogoUrl = "https://developers.google.com/youtube/images/YouTube_logo_standard_white.png";
   var googleLogoBlob = UrlFetchApp
                        .fetch(googleLogoUrl)
                        .getBlob()
                        .setName("googleLogoBlob");
   var youtubeLogoBlob = UrlFetchApp
                         .fetch(youtubeLogoUrl)
                         .getBlob()
                         .setName("youtubeLogoBlob");
   MailApp.sendEmail({
    to: "recipient@example.com",
    subject: "Logos",
    htmlBody: "inline Google Logo&lt;img src='cid:googleLogo'&gt; images! &lt;br&gt;" +
              "inline YouTube Logo &lt;img src='cid:youtubeLogo'&gt;",
    inlineImages:
      {
        googleLogo: googleLogoBlob,
        youtubeLogo: youtubeLogoBlob
      }
    });
  }
  </code></pre>
  
  <p>The email is not sent at all and the code doesn't appear to execute.</p>
  
  <p>When I remove the first 4 statements (setting up the URLs and blobs), and the inlineImages section of the sendEmail function, the email is sent.</p>
  
  <p>What am I doing wrong?</p>