?
Solved

google docs script to send email daily with image

Posted on 2012-03-11
7
Medium Priority
?
333 Views
Last Modified: 2012-10-04
Hi!
I'm using this script in a google doc to send myself an email every day.
How can I include an image in the body of the email?
Thanks!
function myFunction() {
  var subject = "message";
  var message = "This email was sent at " + new Date();
  var recipient = "xxx@gmail.com";

  MailApp.sendEmail(recipient, subject, message );
}

Open in new window

0
Comment
Question by:etech0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 1

Expert Comment

by:ravi_kaalla
ID: 37712643
function myFunction() {
  var subject = "message";
  var message = "This email was sent at " + new Date();
  message += "<img src='smiley.gif' alt='Smiley face' height='42' width='42'/>"
  var recipient = "xxx@gmail.com";

  MailApp.sendEmail(recipient, subject, message );
}

Open in new window

0
 
LVL 10

Author Comment

by:etech0
ID: 37716762
Thanks! How can I tell it where to find the image?
0
 
LVL 1

Accepted Solution

by:
ravi_kaalla earned 2000 total points
ID: 37718361
you can mention the image path in the "src" attribute

function myFunction() {
  var subject = "message";
  var message = "This email was sent at " + new Date();
  message += "<img src='http://www.google.com/images/srpr/logo3w.png' alt='Smiley face' height='42' width='42'/>"
  var recipient = "xxx@gmail.com";

  MailApp.sendEmail(recipient, subject, message );
}

Open in new window

0
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 
LVL 10

Author Comment

by:etech0
ID: 37721617
What if the file is on my computer?
0
 
LVL 10

Author Comment

by:etech0
ID: 37739570
Okay, I put the file in my Dropbox, so google can access it.
Now, I get an email that contains the following:

This email was sent at Mon Mar 19 2012 16:24:15 GMT-0400 (EDT)<img src='http://dl.dropbox.com/u/58086246/memvav.png' alt='Mem Vav'  
width='420'/>

I don't see the image at all.
Why could this be?

Here is my function (with email address changed):

function myFunction() {
  var subject = "This should be for a...";
  var message = "This email was sent at " + new Date();
  message += "<img src='http://dl.dropbox.com/u/58086246/memvav.png' alt='Mem Vav' width='420'/>"
  var recipient = "xxx@gmail.com";

  MailApp.sendEmail(recipient, subject, message );
}

Open in new window

0
 
LVL 10

Author Comment

by:etech0
ID: 37761785
It looks like the email contains the 'text' of html, but is not formatted as html. Why could this be?
0
 
LVL 10

Author Comment

by:etech0
ID: 38416333
Anyone out there?
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question