Send Email with Google Apps Script


There are many ways to send an email through App Inventor. Here is another method that uses a standalone google apps script to handle just sending a message, send a text file from data in your app, or sending an image on your device. The script also allows you to check your emailing quota for the day. A normal consumer gmail account allows for the sending of 100 emails a day (24 hours), this is therefore not suitable for spamming or bulk emails above that quota level. This is a simple demonstration, you can edit your app blocks and script code to handle many other email sending options.


You will need

  • A google account

  • A standalone google apps script. Learn how to set one up HERE

  • An App Inventor app

  • Create your standalone google apps script and paste in the code below. Publish the script, and copy the script url

  • Create your App Inventor app and paste the script url to the variable text

Script Code

A doGet(e) AND a doPost(e) function are required in the script. the doPost() is needed to send the base64 String (usually too big for a doGet()).

function doGet(e) {

var output = '';

if (e.parameter.FN == "textFile") {

var blob = Utilities.newBlob(e.parameter.content, e.parameter.mimetype, e.parameter.filename);

MailApp.sendEmail(, 'Text Attachment example', 'One file is attached.', {

name: 'Email One Attachment',

attachments: [blob]


output = 'Email with text attachment sent';


else if (e.parameter.FN == "message") {

MailApp.sendEmail(, 'Message example',e.parameter.content, {

name: 'Message'


output = 'Email with message sent';


else if (e.parameter.FN = "quota") {

var emailQuotaRemaining = MailApp.getRemainingDailyQuota();

output = 'Remaining email quota: ' + emailQuotaRemaining;


return ContentService.createTextOutput(output);


function doPost(e) {

if (e.parameter.FN == "image") {

var data = Utilities.base64Decode(e.parameter.content);

var blob = Utilities.newBlob(data, e.parameter.mimetype, e.parameter.filename);

MailApp.sendEmail(, 'Image Attachment example', 'One image file is attached.', {

name: 'Image',

attachments: [blob]


output = 'Email with image attachment sent';


return ContentService.createTextOutput(output);