Saturday, 16 November 2013

Notify you through a message when a special mail is received in GMail

I read a lot in general and today came across a tip that allows you to get notified by text message when you receive mail from a previously specified ID. The procedure makes use of the Google calendar's text message feature. The original post can be seen at 5 Useful Google Scripts to Automate your Email.


The script works as follows:
  1. Go to google scripts: script.google.com
  2. Create a blank project.
  3. Script:
    function Gmail_send_sms(){
    var label = GmailApp.getUserLabelByName("Send Text");
    if(label == null){
    GmailApp.createLabel('Send Text');
    }
    else{
    var threads = label.getThreads();
    var now = new Date().getTime();
    for (var i = 0; i < threads.length; i++) { var message = threads[i].getMessages()[0]; var from = message.getFrom(); var subject = message.getSubject(); CalendarApp.createEvent(subject, new Date(now+60000), new Date(now+60000), {location: from}).addSmsReminder(0); } label.removeFromThreads(threads); } }

  4. Save it and set a trigger for it to run every 5 minutes.

  5. Lastly, you have to set a filter to add the “Send Text” label to all important incoming emails. The script will scan your inbox every 5 minutes and when it detects an email with the “Send Text” label, it will create an immediate event in Google Calender which will then trigger the SMS.

That's it. You will get a new text for every new mail. Thank You Google.

No comments:

Post a Comment