Created
May 24, 2017 05:49
-
-
Save cotyembry/d48c4340b866853436bf3760f917d194 to your computer and use it in GitHub Desktop.
This is a .gs (google script) file that will fetch an image from a url using I suppose some of the Google Services APIs, converts that object to a BLOB, then sends the image to the email specified with the images inline within the email (This is so freaking cool - I tested it myself ^_^)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: "[email protected]", | |
subject: "Logos", | |
htmlBody: "inline Google Logo<img src='cid:googleLogo'> images! <br>" + | |
"inline YouTube Logo <img src='cid:youtubeLogo'>", | |
inlineImages: | |
{ | |
//googleLogo: googleLogoBlob, | |
youtubeLogo: youtubeLogoBlob | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment