Solved

google docs script to send email daily with image

Posted on 2012-03-11
7
300 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
  • 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 500 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video teaches users how to migrate an existing Wordpress website to a new domain.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now