Friday, June 27, 2014

Gmail Scheduled Send Email

2:03 AM

Someone recently asked for the ability to schedule send an email. It was for a link to a class feedback form and ideally they'd like to be able to send it near the end of the class.

We looked at Boomerang, which had issues with authenticating with the York domain, and broke the CSS of Gmail slightly. We tried mx Hero, a Chrome app but after a tip off from a colleague and reading the reviews and discovering it at times didn't send the email, or used http rather than https etc we thought it might be better to look into making our own solution.

Apps Script to the rescue!

I wanted something that was really simple, and easily editable to do what you want.

I made an Apps Script to check your Gmail Drafts folder. If there's a message whose subject begins with a date, like this, it sends it ...

[27/06/2014] Hello, this is a message from the future!


How to install it...

1. Go to the Apps Script here and choose the menu, File > Make a Copy. You will want to change the admin_email to your email address (line 32) so that you get a BCC copy of any mail sent out. I have set the emails to come from noReply. You can also change that in line 82.

2. Now, to authorise the script to run, click the Run button and then click OK. This is Google making sure you want this code to be able to be run.



3. From the menu Resources > "Current project's triggers" and create a Trigger that will run the check_drafts() function every 5 minutes or so.  See below....






4. Now you are ready to go. All you now need to do is create draft emails that have title with a date EXACTLY in the format above... All you then have to do is close the email... and wait. It might not send at exactly the time you specify, depending on how often your Trigger is set to run, but it'll be close.





Every time the script runs, it looks for messages that have a date in square brackets. It makes a copy, BCC-ing in the email you specified ( this is important because otherwise it doesn't keep a copy in your Sent folder... you need a copy to make sure it has indeed been sent ). 

The Script creates a label called "Scheduled Gmail Sent" and moves sent drafts to the bin ( unfortunately, Apps Script won't let me send the mail so it appears in the Sent tray or delete it outright ). Maybe you can work out how this bit works.

I couldn't get inline images to work, but attachments work fine.

Remember your Google Gmail quota is 500 a day, but a message with 300 people BCC'd in counts only as one message.







Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top