title: AppScript - Create a Draft Email with https://www.googleapis.com/auth/gmail.compose
body: <p>I'm trying to create an AppScript web app to create a gmail draft in the users draft inbox. I had this working using the <a href="http://www.mail.google.com" rel="nofollow noreferrer">http://www.mail.google.com</a> scope, however, I really want to tone down the permissions to just be able to create a draft email. I tried using <a href="https://www.googleapis.com/auth/gmail.compose" rel="nofollow noreferrer">https://www.googleapis.com/auth/gmail.compose</a> but I keep getting authorisation errors. Is there something I'm missing?</p>
  <pre><code>var forScope = GmailApp.getInboxUnreadCount(); // needed for auth scope
  
  //Create Email Structure
  var subject = &quot;Email Subject&quot;;
  var img = DriveApp.getFileById(&quot;Insert ID&quot;).getBlob();
  var body = &quot;&lt;img src='cid:images' style='width:100%'&gt;&lt;br&gt;Test Email Content&lt;br&gt;&quot;
  var signature = Gmail.Users.Settings.SendAs.list(&quot;me&quot;).sendAs.filter(function(account){if(account.isDefault){return true}})[0].signature;
  var email = Session.getActiveUser().getEmail();
  var newBody = &quot;&lt;p&gt;&quot;+body+&quot;&lt;p&gt;&quot;+signature;
  
  //Create Draft
  var draft = GmailApp.createDraft(&quot;&quot;, subject, body, {htmlBody: newBody, inlineImages:{images:img}});
  
  return;
  </code></pre>