Read a Random Post

Get Free SMS Alerts for New and Important Emails on Gmail with Google Docs

Written by

Topics: Tips & Tricks

Consider a situation you are away from your computer and in travel waiting for an important email which you need to reply in a timely manner and all you have with you is your mobile-phone. Instead of constantly checking your inbox you can setup SMS alerts which notify you on receiving emails. Recently we saw how to use Google Docs to monitor multiple sites and send free alerts when they are down. In this article we are going to see how to turn Google Docs into Email Notifier to send you free SMS alerts for important and new incoming emails on Gmail.

There are already some ways to achieve this using third-party services or using free SMS gateway by setting up email forwarding. But they do have restrictions and limitations. E.g.: Country based limitations. Sometimes they don’t work at all. Of course privacy is another important concern. I am sure many of us are in need of this SMS alert feature, number of queries raised in various Google forums are a proof for this. So, let’s create our own email notifier service with Google Docs.

Below trick is pretty simple it just takes at the max of 5 minutes to setup. It only uses services provided by Google, no third-party services are involved. Importantly it works in almost all countries, free of cost.

How does it work?

Get Free SMS Alerts for New Emails on Gmail with Google Docs

1. Creating a filter condition and linking it to a label in Gmail.

2. Google Docs periodically monitors the label thread for new incoming emails and creates a Google Calendar SMS reminder on receiving it.

3. Google Calendar sends you a SMS alert containing the subject of your message.

So lets see how to set it up. Might look lengthy but it’s very easy.

Get Free SMS Alerts for New and Important Emails on Gmail with Google Docs


1. Setting up Google Calendar to make SMS as default reminder channel

You can follow the instructions on how to configure for Google Calendar for phone notification from our previous article.

2. Creating filter condition and linking to Label in Gmail

  • Login to Gmail.
  • Click on the Gears icon on the top right and select Settings.
  • Go to Labels tab.
  • Scroll down and click Create new label.
  • Give label name as sendsms and click create. Now label creation is done.
  • Now click on filter tab.
  • Click Create a new filter.
  • If you want SMS alerts only for emails from some important person such as your boss. Set the filter condition using ‘from’ field.

    Gmail filter condition for receiving SMS alerts

    If you want SMS alerts for all incoming emails. Set the ‘Has the words’ field with is:inbox

    Get SMS alerts on receiving new email in Gmail

  • Click Create filter with this search.
  • Now check Apply the label and select sendsms from the drop down. Finally click create filter.
  • free sms alerts on receiving email on Gmail

3. Configuring Google Docs To Poll for New Incoming Emails

1. Login to Google Docs.
2. Click here to make copy of the spreadsheet. Click Yes, make a copy.
3. Now select Tools-> Script Editor. Then Resources-> Current script’s triggers.
4. Select click here to add one. Under events select Time-Driven then minutes timer and every minute and save it.
5. Click Authorize and then grant access. Now click close and save the trigger again. That’s it.

So, now on Google Docs will be polling your Gmail Account every minute for new incoming messages through the label you have created and will send a free SMS alerts as and when they arrive.

Thanks Romain Vialard for the original script.

Never miss any important emails be informed as and when they come to your inbox. Have trouble in setting this up? Do feel free do drop in your queries and problems.

342 Comments For This Post I'd Love to Hear Yours!

  1. Lynn Brown says:

    This is a great tip. I don’t use google docs but this could a good service for my emails. Will be looking into this real soon. Thank you for sharing your tips and advice on this.

    • Shunmugha Sundaram says:

      Welcome here mam :)

      Thanks. This is one of the best way to get notifications for free. Especially will be very useful when you are waiting for some important mail.

      • LOKESH says:

        WHER WOULD WE GIVE OUR MOBILE NO. ?

        • Claudia says:

          Well, I was able to set it all up. But there was no question about my mobile number. Have tested it with one of my other email addresses and – no suprise – it doesn’t work.

          Which step or information did I miss?

          • Claudia,

            Did you complete the Google Calendar setup (http://techawakening.org/website-downtime-free-sms-alerts-google-docs/988/#smssetup) mentioned in step 1? There you will be mentioning the number.

    • Naren says:

      hey i hav gone throuh all d above procedure bt still its not working.
      i havnt receive any sms from gmail.
      and plz tell me one more thing how cn i saw ma mobile no.

  2. Wonderful tip, i will be using google docs to upload my files and docs so it would be great if i get sms alerts of my documents.

  3. Bryan says:

    Hi Shunmugha
    This is a great tip. I rarely use Google Doc. But this is very good service . thanks for sharing this with us.
    Bryan

  4. Hi Shunmugha

    I didn’t use Google docs functionality but it’s seems good now I try to post my docs on Google cloud.

  5. Wow! Helpful tips for me. As I use frequently Google Docs, this tip can help me a lot.

  6. Outstanding info once again. Thank you:)

  7. OlegT says:

    Here is the code that sends an SMS to all new inbox messages

    function SendSMS() {
    var sheet = SpreadsheetApp.getActiveSheet();
    var idemail = sheet.getRange(“A1″).getValue();
    var message = GmailApp.getInboxThreads(0,1)[0].getMessages()[0]
    var MesI = message.getThread().getMessageCount()
    message = message.getThread().getMessages()[MesI-1]
    var lastDate = message.getThread().getLastMessageDate()
    if (message.isUnread()){
    if (idemail<lastDate){
    sheet.getRange("A1").setValue(lastDate)
    var cal = CalendarApp.getDefaultCalendar();
    var d = new Date(); d.setMinutes(d.getMinutes() + 1)
    cal.createEvent(message.getSubject(), d, d, {location: message.getFrom()}).addSmsReminder(0);
    }
    }
    }

    • Shunmugha Sundaram says:

      OlegT,

      Thanks for the code :)

    • R says:

      When I put this code: appears out this warning: Illegal character. (line 3)

      var idemail = sheet.getRange(“A1″).getValue();

      • Shunmugha Sundaram says:

        Please wait. I am looking into your issue. With regards to illegal character error refer this:

        http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-1233

  8. zmyest says:

    Can you make an video of it and upload it on YouTube.com.
    You’ve explain everything clearly but it’ll be really helpful if you make an video of it.
    Thanks

  9. zmyest says:

    1. Can’t we make that spreadsheet by ourselves? what’s the need to copy?
    2. Is it safe?
    that code which we have written and moreover copying that spreadsheet?
    Don’t mind, But I just don’t know anything about google docs,calendar that’s why I’m asking.

    • Shunmugha Sundaram says:

      1. Yes, you can make the spreadsheet yourself. Just copy, paste the code onto script editor and setup the triggers. Copying the sheet eases the work of manually copying the code.

      2. Yes, it’s absolutely safe. But it’s advisable that we investigate the code. For example sending a copy of the email you receive to another email is possible.

      P.S: Code I have written is clean :)

  10. zmyest says:

    Is it necessary that our mobile phone should remains open at the time when we get an email in our inbox? or can we get email alert even after a day if the mobile phone is switched off?

    • Shunmugha Sundaram says:

      To receive email alert it’s not necessary that your mobile remains switched on, it will be delivered to your inbox. You can access it anytime. Whereas to get SMS alerts your mobile should be switched on.

  11. zmyest says:

    Thanks a lot brother for your reply, I’m using it now. Its just fantastic.
    I have got an reminder in my mobile phone as

    Reminder: Subject
    date time
    my email id

    Is there any way to get the email address from which we are receiving the email.
    It will be really helpful if we get the email address of the sender also..
    thanks again.

    • Shunmugha Sundaram says:

      Welcome :) OK. Change the line

      CalendarApp.createEvent(threads[0].getFirstMessageSubject(),new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

      to

      CalendarApp.createEvent(threads[0].getFirstMessageSubject() + threads[0].getFrom(),new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

      Do share the post with your friends!

  12. zmyest says:

    bro, I’m sorry i have no idea how to edit that, I don’t know anything about google docs… would you tell step by step procedure please?

    • Shunmugha Sundaram says:

      Go to Data->Script Editor. Change the line I have mentioned then save it. That’s all.

  13. optimus says:

    Great post..!!
    While changing to this:
    “CalendarApp.createEvent(threads[0].getFirstMessageSubject() + threads[0].getFrom(),new Date(now+60000),new Date(now+60000)).addSmsReminder(0);”
    I am getting an error of:
    “TypeError: Cannot find function getFrom in object GmailThread. (line 7)”
    Please clarify.

  14. optimus says:

    And also if possible, please include some line of removing previous events in Google Calendar (the events which were created by this script only) as when I opened my Google calendar, my browser hanged and I could not update any settings (This would also help me in keeping Calendar clean in case I need it later someday). It would be perfect.. Thanks again for wonderful post… :)

  15. optimus says:

    hey, sorry but my first comment was not published. The suggestion you gave for ‘zmyest’ to include senders email Id didn’t work for me. I was getting an error of ‘TypeError: Cannot find function getFrom in object GmailThread.’.. any solution for this?

    • Shunmugha Sundaram says:

      Optimus,

      Here is the updated version. Change the line

      CalendarApp.createEvent(threads[0].getFirstMessageSubject(),new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

      to

      var message = threads[0].getMessages()[0];
      var sender= message.getFrom();
      CalendarApp.createEvent(threads[0].getFirstMessageSubject() + sender,new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

      • rtuniki says:

        var message = threads[0].getMessages()[0];
        var sender= message.getFrom();
        CalendarApp.createEvent(threads[0].getFirstMessageSubject() + sender,new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

        var sender= message.getFrom();

        the 2nd line of code should be actually
        var sender= message[0].getFrom();

        • Shunmugha Sundaram says:

          I believe it isn’t necessary because message variable is already a primitive type not an array.

          • rtuniki says:

            Shunmugha Sundaram FYI
            A primitive type is predefined by the language and is named by a reserved keyword.
            Primitive values do not share state with other primitive values.

            here message is an object; clearly
            Class.functionName() OR newObject.methodName()

            and getFrom() expects and array not a primitive type as you said!

            Cheers!
            rtuniki

          • Shunmugha Sundaram says:

            Agreed but it’s just object not an array of object hence message[0] is not required.

          • rtuniki says:

            My Dear Friend,

            YOU Said: I believe it isn’t necessary because message variable is already a primitive type not an array.

            RULE #1

            And the answer is:
            PRIMITIVE DATA TYPES are not OBJECTS;

            A primitive type is predefined by the language and is named by a reserved keyword.
            Primitive values do not share state with other primitive values.

            Secondly YOU Said: Agreed but it’s just object not an array of object hence message[0] is not required.

            And the answer is:
            An array is a container object that holds a fixed number of values of a single type.
            The length of an array is established when the array is created. After creation, its length is fixed.

            message[index].getFrom();

            HERE:
            message is a container object that holds a fixed number of values of a single type;
            And here the values are: The SENDER;

            Pls don’t confuse yourself or others, by confusing yourself;

            Cheers
            Rakesh,

          • Shunmugha Sundaram says:

            Thanks for the insight! :)

  16. zmyest says:

    Brother, I did replaced the lines but then also I’m not getting email address of the sender, now what to do?

    • Shunmugha Sundaram says:

      Sorry. Try the updated version:

      http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-639

      After replacing, save the script.

  17. zmyest says:

    great bro, its working perfectly.
    thanks a lot once again for this remarkable post…

    I think with this we can get email alerts throughout the world?
    right?

  18. zmyest says:

    Although it is more then enough to get email address + subject. but as you have able to write the code for getting senders email id, I’m just curious that is it possible to even get the text message which they’ll send us.

  19. zmyest says:

    bro, i’m getting this message. can you tell wat it is…
    Reminder: Summary of failure for Google Apps Script:
    Copy of Send…@
    date month year
    time
    myemail id.

    • Shunmugha Sundaram says:

      I guess if you have over used the resources, Google will send failure notifications.

    • OlegT says:

      When adding a trigger you needed to disable error notifications
      Tools / Script editor / Resources / All your triggers… / notification

      • Vikas says:

        Hi,

        Have used this technique for the last 20 days and was getting alert of all mails. But for the last two days, it almost stopped. Getting alerts for only few mails.

        Please let me know what to do.

  20. Siddharth says:

    Nice article! But sometimes the subject and the name gets messed up. Can you tell how to add ” From:” before a senders name or email?

    • Shunmugha Sundaram says:

      Siddharth,

      Welcome!

      var message = threads[0].getMessages()[0];
      var sender= message.getFrom();
      CalendarApp.createEvent(threads[0].getFirstMessageSubject() + "From: "+sender,new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

      • benjamin says:

        Hi,
        Thankyou for your post.
        When I use this section of code and save it, it says “illegal character line 15″, and doesn’t work.
        what could I use instead for intended effect?
        many thanks.
        Benjamin

        • Shunmugha Sundaram says:

          Benjamin,

          Please remove all the double quotes and manually type it. Change all “ to "

          I have also updated above chunk of code to remove all illegal characters, try using it now.

          • Benjamin says:

            Thanks so much for replying so quickly!
            It now works. The other thing I had to do was go to the “triggers” window, save and “Authorize” again before it worked.

            Is there somewhere you can recommend to learn the basic scripting language used here?

            Kind regards.

          • Shunmugha Sundaram says:

            You are most Welcome Benjamin. If you liked this article do share it on social networks. Would you ? ;)

            Here are few references to help you learn basics:

            http://googleappsdeveloper.blogspot.in/
            http://www.google.com/script/start/

      • R says:

        Greetings,

        I tried the above mentioned codes and I still receive ONLY what is sent the in subject line, I do not receive the Sender’s E-mail address, Sender’s Name a E-mail body Text.

        Thanks & best regards

      • R says:

        Hi Shunmugh,

        1- I inserted the following codes:-

        /* Get Free International SMS alerts for new incoming Emails on Gmail*/

        /*Instructions at http://techawakening.org/?p=1130 */

        /*Original Script by Romain Vialard
        Modified by Shunmugha Sudararm for Techawakening.org*/

        function sendsms() {
        var label = GmailApp.getUserLabelByName(‘sendsms’);
        var threads = label.getThreads();
        var now = new Date().getTime();
        for(i in threads){
        CalendarApp.createEvent(threads[0].getFirstMessageSubject(),new Date(now+60000),
        new Date(now+60000)).addSmsReminder(0);
        }
        label.removeFromThreads(threads);
        }

        And I receive the sms notifications without the sender’s name and e-mail address.

        Also when I put directly a Reminder on the Calender, I receive it regularly.

        2- I inserted the following codes:-

        /* Get Free International SMS alerts for new incoming Emails on Gmail*/

        /*Instructions at http://techawakening.org/?p=1130 */

        /*Original Script by Romain Vialard
        Modified by Shunmugha Sudararm for Techawakening.org*/

        function sendsms() {
        var label = GmailApp.getUserLabelByName(‘sendsms’);
        var threads = label.getThreads();
        var now = new Date().getTime();
        for(i in threads){
        var message = threads[0].getMessages()[0];
        var sender= message.getFrom();
        CalendarApp.createEvent(threads[0].getFirstMessageSubject() + “From: “+sender,new Date(now+60000),new Date(now+60000)).addSmsReminder(0);
        }
        label.removeFromThreads(threads);
        }

        I did not receive the sms notifications But the sent e-mail goes to the calender as a Reminder named “Subject line From: Sender Name ”

        So the function exports the sent e-mail to the calender with the subject line and Sender’s name and e-mail address but I do not receive the sms notification.

        Another strange thing: when I put directly a Reminder on the Calender, I do not receive it when the second codes are inserted.

        So the second code blocks both the sms notifications of the imported E-mail from Gmail and for the direct reminders.

        Waiting to hear from you!

        Thanks and best regards,

        • rtuniki says:

          Shunmugh,
          Since you are in loop(for loop) you can use the index instead.

          /*
          //modified by rtuniki;
          //rtuniki@gmail.com
          //http://facebook.com/rtuniki

          function sendsms()
          {
          var label= GmailApp.getUserLabelByName(‘Sendsms’);
          var threads= label.getThreads();
          var now= new Date().getTime();

          for(i in threads)
          {
          var message= threads[i].getMessages();
          var from= message[i].getFrom();
          CalendarApp.createEvent(threads[i].getFirstMessageSubject() + “From: “+from,new Date(now+60000),new Date(now+60000)).addSmsReminder(i);
          }
          label.removeFromThreads(threads);
          }
          */

  21. Siddharth says:

    Thanks!

  22. Siddharth says:

    Also the text limit is 119 per SMS. Is there any other way to increase the text limit?

  23. samflo says:

    hi, if you help us to remove the remainders created by your event script after the SMS got fired will, be helpful to manage our google calender efficiently. but this script is doing great.

    many thanks!!!

  24. prime says:

    Hey,
    I followed the instructions which are given here and also the script by Romain Vialard. However, when I checked the script by sending a mail from my other account, I got the SMS but then I got it continuously for 20-30 times for the same email.
    Any idea how to correct this?

  25. zmyest says:

    Shunmugha Sundaram:
    Bro, I’ am getting this error for 4 times daily which says

    Reminder: Summary of failure for Google Apps Script:
    Copy of Send…@
    date month year
    time
    myemail id.

    please tell me how to stop receiving this error messages.

    • Shunmugha Sundaram says:

      Disable the notifications as suggested by OlegT.

      http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-684

  26. zmyest says:

    bro, date and time is taking too many characters and its taking subjects and senders emails space in it.
    how to remove date and time?

  27. zmyest says:

    Shunmugha Sundaram: Bro how not to get date and time in the message which we get..?
    its taking too many characters in the reminder message..

    • Shunmugha Sundaram says:

      zmyest,

      Google is appending the time stamp in the message by itself. I am not inserting the time in the code.

  28. George says:

    Many thanks!!! Very useful, just checked it and it works! Great job…

  29. Mohamed says:

    Hello there,

    Thank you very much for this great article It’s really very useful for me. I have some questions please :

    1-Why does it show MY email address in the SMS message? It doesn’t show the sender’s or the editor’s address.

    2-Is it possible to shorten the date format a bit? So that I can see more of the actual content in the message?

    3-Regarding the chart limit of 119 I think I have WAY Less limit, can this be caused by arabic letters in the message?

    Thanks very much!!

    • Shunmugha Sundaram says:

      Thanks!

      - You can refer my previous comment on how to include sender’s email id in the message.

      http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-676

      - Date is appended automatically by Google. I guess we could not do anything about that.

      - Ya that might be the reason behind it.

      If you liked the article do share it on Social networks :)

    • OlegT says:

      To ensure that SMS does not contain your email, you need to rename the calendar. Go into the settings of google calendar / Calendars / Calendar Name.

  30. webraketa says:

    Thank you very much, everything works perfectly.

  31. mnwajihi says:

    Hi. Thanks for the script. Is it possible to get text from the body of the email message, to be sent in the SMS alert (as much as would fit)? What do I add to the script to enable that? Thanks.

  32. Yoshimi says:

    I didn’t receive all sms alerts.

    I wonder why?

  33. kris says:

    worked like a charm(although getting atleast 3 sms 4 same mail.p.s-i have not manually ran the script).three cheers 2 u :)

    • Shunmugha Sundaram says:

      Kris,

      You are most welcome. Ideally you should get only one SMS per email not sure why that many are coming :) Just cross check by going to Google Calendar and see if only one reminder is created per email if that’s the case nothing to worry.

      If you liked the article do share it. Give it a like and share :)

  34. Ajit says:

    Hi.
    I do not get all sms alerts !.

    I also get the copy of failed sms with details in my email. Iam not worried about these email notifications rather it helps me know whether the circuit is intact or not.

    What shud i do to get all sms alerts without missing any ?.

    rgds

  35. Ajit says:

    Hi.
    I do not get all sms alerts !.
    email notification says – “Cannot connect to Gmail (line 9)”

    I also get the copy of failed sms with details in my email. Iam not worried about these email notifications rather it helps me know whether the circuit is intact or not.

    What shud i do to get all sms alerts without missing any ?.

    rgds

    I also get the copy of failed sms with details in my email. Iam not worried about these email notifications rather it helps me know whether the circuit is intact or not.

    What shud i do to get all sms alerts without missing any ?.

    rgds

    • Shunmugha Sundaram says:

      Not sure why it has failed. Could be a network issue. Try again following the instructions exactly as mentioned.

      Cheers!

  36. CS VIKGNESHKUMAR says:

    Hi
    Nice, I Work with elance, freelancer and i get remainders to log on and work , Great tip sir

  37. Sandeep Jain says:

    Is the same facility available for Yahoo and other mails?

    • Shunmugha Sundaram says:

      No Sandeep it’s not available for other providers. Sorry. This demo uses Gmail API’s.

    • Shunmugha Sundaram says:

      But alternatively you can create a Gmail account then set an auto forwarding rule in other providers like Yahoo, Hotmail to send a copy of all incoming emails to Gmail account. After which you can follow the above trick.

  38. R says:

    Hello Shunmugha Sundaram,

    I followed all the steps in this page and I have received sms notifications.

    But when I receive the sms, I receive ONLY which is written in the Subject Line of the E-mail sent to my inbox, I do not receive the Sender’s name, Sender’s E-mail Address and E-mail Body Text!!

    Is there a way to receive also, in the sms notification, the Sender’s E-mail address and the E-mail Body Text??

    Looking forward to receive your prompt reply.

    Please accept my best regards,

    • Shunmugha Sundaram says:

      Hi,

      Thanks for dropping in your query. If you want sender email id too do the code modification mentioned here:

      http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-639

      But you will not be able to receive body because Google imposes limit on the length of the SMS so email body text will not fit into the SMS that’s the problem. Hope I have clarified your doubts now.

      If you liked this article, do like and share on Facebook and other social networks :)

      • R says:

        Hi Shunmugha Sundaram,

        Look, this is the original script:

        /* Get Free International SMS alerts for new incoming Emails on Gmail*/

        /*Instructions at http://techawakening.org/?p=1130 */

        /*Original Script by Romain Vialard
        Modified by Shunmugha Sudararm for Techawakening.org*/

        function sendsms() {
        var label = GmailApp.getUserLabelByName(‘sendsms’);
        var threads = label.getThreads();
        var now = new Date().getTime();
        for(i in threads){
        CalendarApp.createEvent(threads[0].getFirstMessageSubject(),new Date(now+60000),
        new Date(now+60000)).addSmsReminder(0);
        }
        label.removeFromThreads(threads);
        }

        And this is the updated version to be able to receive also the sender’s E-mail address:

        /* Get Free International SMS alerts for new incoming Emails on Gmail*/

        /*Instructions at http://techawakening.org/?p=1130 */

        /*Original Script by Romain Vialard
        Modified by Shunmugha Sudararm for Techawakening.org*/

        function sendsms() {
        var label = GmailApp.getUserLabelByName(‘sendsms’);
        var threads = label.getThreads();
        var now = new Date().getTime();
        for(i in threads){
        var message = threads[0].getMessages()[0];
        var sender= message.getFrom();
        CalendarApp.createEvent(threads[0].getFirstMessageSubject() + sender,new Date(now+60000),new Date(now+60000)).addSmsReminder(0);
        }
        label.removeFromThreads(threads);
        }

        Am I right???

        Waiting for your reply

        Best regards,

    • Shunmugha Sundaram says:

      I have updated the sheet now. Make copy of this new version and try now.

      You will be getting sender email id along with the subject now.

      https://docs.google.com/spreadsheet/ccc?key=0Aqy7rBwoHlSvdHo3QkNCem1YNHY1YmtfOGl0RzZaVEE&newcopy=true

      Do share this article if you found it useful.

      Cheers!

      • R says:

        Hi Shunmugha Sundaram,

        The function exports the sent E-mail to the Calendar with both the sender email id along with the subject, BUT I do not receive the sms notification!!

        Thanks!!!

        • Shunmugha Sundaram says:

          This code tracks only incoming emails not sent mails. Delete the old sheet and start over again. Create the label correctly and map it to the filter. Then copy the updated sheet and set up the triggers. I have tested it and it’s working.

          Also see if you have turn on SMS as your default notification channel on Google Calender.

          • R says:

            Dear Shunmugha,

            Yes, I know that this code tracks only incoming emails, which are SENT to me.

            Brother, if the code exports the incoming emails to the calender that means that the label is created correctly, and it’s mapped to the filter, right??

            My default notification channel on Google Calender is SMS!!

            Try to send me an e-mail, as a test!!

            Thanks

          • Shunmugha Sundaram says:

            Yes. If it appears in calendar it means that the code is doing it’s job correctly. OK can you tell me what is your filter condition? Have you created it for all incoming emails or ?

            If you won’t mind share your screen with me. Do it via https://join.me/

          • R says:

            This is my filter condition:

            Matches: is:inbox
            Do this: Apply label “sendsms”

          • Shunmugha Sundaram says:

            Hmm.. That could be the problem. It might be causing excessive resource usage. Just try creating filter using some condition instead of is:inbox. Try from tomorrow. As of now delete and keep all reminders created by this script in your calendar.

            Then let me know what happened.

          • R says:

            Let me understand better:

            I will delete the current condition and I will create a filter to receive sms notifications for e-mails sent to my inbox from sender@hotmail.com

            And for the current reminders in my calender, will I delete them all??

          • Shunmugha Sundaram says:

            Yes you are rite, create filter constraining it to only selected persons (Eg: Boss). Delete all reminders create by this script alone. Then stop the trigger by deleting it. Tomorrow again create a new trigger and see how things go about.

          • R says:

            Now there is no reminders in my Google Calendar.

            Now There is no files in my Google Drive.

            I created a new filter in my Google Mail.

            Tomorrow I will create a new trigger, and I will surly inform you about the new situation.

            Thanks a lot bro Shunmugha!

          • Shunmugha Sundaram says:

            Way to go :) Welcome buddy.

          • R says:

            Hi Shunmugha,

            Few minutes ago, I copied the sheet you have updated: (https://docs.google.com/spreadsheet/ccc?key=0Aqy7rBwoHlSvdHo3QkNCem1YNHY1YmtfOGl0RzZaVEE&newcopy=true).

            I waited more than 24 hours since I deleted yesterday the old trigger.

            I will inform you if I will or not receive the sms notifications with the sender e-mail address.

            Thanks and best regards,

          • R says:

            Hi Shunmugha,

            Look there is new situation:

            The code exports correctly to the Calendar the e-mail I received with subject line and sender name and sender e-mail address.

            This is the exported text to the calendar:

            Subject line: sender name

            but I did NOT receive the sms notification!!!

            I put directly a reminder on the calender using the same text but without the two like this:

            Subject line: sender name sender@domain.com

            and I RECEIVED the sms notification!!!!

            What do you think??

          • R says:

            Hi,

            I think that when the e-mail address is put between less-than sign & greater-than sign, the sms notification can not be received!

            I put a reminder directly on the calendar with only the two less-than sign & greater-than sign without any another characters, and I received the sms notification.

            ALSO I put a reminder directly on the calendar with the text: e-mailaddress@domain.com between the two less-than sign & greater-than sign and I did NOT receive the sms notification.

            ALSO I put a reminder directly on the calendar with the text: e-mailaddress@domain.com without the two less-than sign & greater-than sign and I received the sms notification.

            ALSO I put a reminder directly on the calendar with the text: world between the two less-than sign & greater-than sign and I did not receive the sms notification.

            SO WHEN THERE IS A WORLD OR AND E-MAIL ADDRESS PUT BETWEEN THE TWO LESS-THAN SIGN & GREATER-THAN SIGN, THE SMS CAN NOT BE RECEIVED!!!!

            Is there a way to receive the sms notification with the subject line and the sender name WITHOUT his e-mail address as the e-mail address must be put between the two less-than sign & greater-than sign???!!!

            Or a way to receive the subject line and the sender name and the sender e-mail address but WITHOUT the two less-than sign & greater-than sign which block the sms notification even if the reminder is put directly??

            Thanks!

          • Shunmugha Sundaram says:

            Strange. I believe that isn’t causing the problem because I am getting it properly see this screenshot:

            http://i47.tinypic.com/349axb5.png

            But if you still think that is causing the problem, for your satisfaction try what I have said in the email :)

          • R says:

            Can I receive also in the sms notification the e-mail body??

            I know that I will not be able to receive it because Google imposes limit on the length of the SMS, but if the e-mail body contains only one word, so can I receive it???

            Thanks!

        • R says:

          YESSSSSSSSSSSSSSSSSSSSSS YOU ARE GREAT!!!!!

          FINALLY I RECEIVED THE SMS WITH THE SUBJECT LINE, WITH THE SENDER NAME AND WITH THE SENDER E-MAIL ADDRESS!!!

          Thanks a lot!!!

  39. Azucena says:

    It works wonderfully. Is there any way to limit the number of characters of message subject? (let say to 5 characters)
    I also use google voice (and forward text messages to my gmail) and all I want to know is if it is a text or an email message, so the first 4 or 5 characters of the subject will suffice.
    Thanks in advance

    • Shunmugha Sundaram says:

      Azucena,

      Welcome :) In that case you need to modify the code as follows. Change the line

      CalendarApp.createEvent(threads[0].getFirstMessageSubject(),new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

      to

      CalendarApp.createEvent(threads[0].getFirstMessageSubject().substring(0,5),new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

      Try and tell me if it worked for you. Also don’t forget to like and share the article :) Do spread the word.

      Cheers!

  40. Azucena says:

    Not sure if my post was actually delivered. I was looking to limit the subject to 5 characters.
    Thanks again
    A

  41. Phil says:

    Hi,

    thanks for this awesome post!

    Is it possible to specify a certain calendar to be used for the SMS alerts (in addition to the modification above to have the sender included in the sms), as I would prefer to not have them in my default calendar?

    Thanks in Advance.

    Phil

    • Shunmugha Sundaram says:

      Phil,

      Thanks! That’s an awesome suggestion. I guess it’s possible. Will soon implement it and update the doc. Will let you know once done. It will be useful for other users too :) Cheers to you!

      Mean while if you found this article useful do share it on social networks. Spread the love.

      • Phil says:

        Shunmugha,

        Thanks a lot. And please keep me posted if you find a solution for the above problem.

        Another thing that I (and others maybe too) would value very much would be, if you have an idea to make this work for new mails marked as important by GMail (as in the Priority Inbox). Unfortunately the standard gmail filter do not work as the search term ‘is:important’ “will never match incoming mail”.

        Thanks again.

        Phil

      • Klara says:

        I’d love this feature, too!!
        Because now I get sms alerts about all events in my main calendar, which is so annoying that I stopped using it.

        • Shunmugha Sundaram says:

          Hmm. My bad :( Will make sure that this feature is available by this weekend ;) Do share this article.

  42. Ajit says:

    Hi Shanmugha

    I get an error message :
    sendsms TypeError: Cannot call method “getThreads” of null. (line 10)

    In the filter , In FROM section my 2 sender’s email id is written separated by “OR ” eg: first@eu OR second@gmail.com.

    Iam not getting the sms alerts from one sender(second@gmail.com) and iam getting the sms alerts from the other sender (first@eu).

    Until day before , things worked fine but from yesterday this problem has started ,… Can U help me out ?.

    much regards

    • Shunmugha Sundaram says:

      See if you have given the correct label name. It should be sendsms

      • Ajit says:

        iam not getting thru the problem… the line 10 error written before persists. is there any way i can clean any cache etc of the google doc.. i dont know. i guessed !.

        regrads

        • Ajit says:

          Hi Shunmugha

          thanks for ur quick replies as always.I was sent this message from google app failure notification.

          Summary:
          Error Message Count
          Cannot connect to Gmail (line 9) 2
          TypeError: Cannot call method “getThreads” of null. (line 10) 863
          We’re sorry, a server error occurred. Please wait a bit and try again 1

          It seems I had all the problems due to server failure? google. Is it so ?.Can i cancel notifications so that resources are not over used !. I dont know.

          Secondly, today I have started getting all the smss properly.

          Is there any other provider like google who provides email to sms conversion ( yahoo,rediff have limitations )?.( Becoz server failure wud affect my entire busi affair).

          thanx in advance.

          • Shunmugha Sundaram says:

            It’s probably because you have overused the system resources. Google Apps free version does imposes limits to avoid misuses. If is going to effect your business suggest you to go for Google Apps for Business which is the paid version.

            Yes, there are some third party service which promise these kind of services but most of them are not dependable.

            Or alternatively reduce the triggers time from minutes to hourly to avoid exceeding quota limits.

            Hope it helps. Would appreciate if you can like and share this article if you found it useful.

  43. rtuniki says:

    //modified by rtuniki
    //rtuniki@gmail.com
    //http://facebook.com/rtuniki

    /*
    function sendsms()
    {
    var label = GmailApp.getUserLabelByName(‘Sendsms’);
    var threads = label.getThreads();
    var now = new Date().getTime();

    for(i in threads)
    {
    var message = threads[i].getMessages();
    var sender= message[i].getFrom();
    CalendarApp.createEvent(threads[i].getFirstMessageSubject() + “From: “+sender,new Date(now+60000),new Date(now+60000)).addSmsReminder(i);
    }
    label.removeFromThreads(threads);
    }
    */

    thanks,
    rtuniki

    • Vikas says:

      Hi,

      Thankx for your code.

      But when i run it, i m getting error like “Illegal character at line 4″.
      i.e, on line “var label = GmailApp.getUserLabelByName(‘Send SMS’);” of the code.

      Please help.

  44. AJIT says:

    Hi Shunmugha

    Thnx for all help.

    1. For Google Apps for Business (paid) service, how to use your application to get the smss?.

    2. Wont be using other third party services.

    3. Every minute I get important mails for sms purpose. hence cant switch to hour driven mode.

    4. I have kept not to notify me but still i get app script failure notifi immediately. !

    I seek ur advice on above.

    thanx

    • Shunmugha Sundaram says:

      The procedures are same only difference is you will have higher quote limits. To turn off script failure notification refer this :

      http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-684

  45. AJIT says:

    Its heartwarming to see ur prompt replies for all queries raised. i will do likewise and info u if i face further problems .
    thankx big !.

  46. Ajit says:

    Hi Shunmugha

    Why do I get same sms messages many times.
    iam using the follwoing code:

    /* Get Free International SMS alerts for new incoming Emails on Gmail*/

    /*Instructions at http://techawakening.org/?p=1130 */

    /*Original Script by Romain Vialard
    Modified by Shunmugha Sudararm for Techawakening.org*/

    function sendsms() {
    var label = GmailApp.getUserLabelByName(‘sendsms’);
    var threads = label.getThreads();
    var now = new Date().getTime();
    for(i in threads){
    CalendarApp.createEvent(threads[0].getFirstMessageSubject(),new Date(now+60000),
    new Date(now+60000)).addSmsReminder(0);
    }
    label.removeFromThreads(threads);
    }

    I do not want senders email address and this code does not send senders email also.

    I installed .. installed the speradsheets manytimes. but always multiple times same message got !!.

    help reqd…

    • Shunmugha Sundaram says:

      Ajit,

      If you want sender’s email too use the updated sheet instead. Refer to previous comments.

      • Ajit says:

        Hi

        I do not want senders email id and the above code does not send the same.

        repeated messages: for eg: at 7.30 pm my inbox got 4 emails as alerts. google calender showed only 1 alert polled and sent it to me three times and missed to send me the other 3 emails which i shud have had got…. how to go about this..?.

        rgds

        • Shunmugha Sundaram says:

          If you don’t want sender id to be sent remove the sender variable.

          i.e.,

          CalendarApp.createEvent(threads[0].getFirstMessageSubject(),
          new Date(now+60000),new Date(now+60000)).addSmsReminder(0);

          If it is a threaded/nested emails only first message from it will be sent not the others.

          • Ajit says:

            Hi

            1. I removed the sender variable from the code and no more I get the sender details.

            2. i created the label “send sms” as a main head and is not nested(as u adviced) . I have not created any other label or nested label also.
            Still the repeated same messages persists.

            !@$#… dont know what to do.

            thanks in adv

  47. White Knight says:

    Thanks so much for such a great Script..! :)

  48. Subhadeep says:

    Thank you very much Shunmugha Sundaram. Its very helpful for me. Keep this good work up. Thanks again man. :)

    • Shunmugha Sundaram says:

      Thanks Subhadeep! Stay in touch by signing up for newsletter. There is more articles coming up in future featuring Google Docs to do useful stuffs. Do share this post on social networks :D

  49. ALI says:

    gud jann

  50. Sand says:

    I got repeated sms for one email, almost 20 sms before i disbale the feature. What went wrong?

  51. Moosa says:

    hi Shunmugha Sundaram

    I need to get all the mail alerts through sms. so i choosed second option.

    I have done everythin as u mentioned in your steps…..

    but stil i coundnt get the alerts…

    any idea of this issue??

    • Shunmugha Sundaram says:

      Could you please elaborate on what you mean by second option I could not get you. For it to work you need to follow all the steps starting from setting up Google Calendar.

      • Moosa says:

        Yeah I did all the steps ma… i am getting only few mails only not all the mails which are coming to my gmail…

        • Shunmugha Sundaram says:

          It depends on the filter condition you have sent. Also if you have exceeded the allocated limit you will not be receiving it.

  52. Shrinivas says:

    It is an useful tip indeed.. I was searching to get email alerts as SMS and got it here.. Thank you..

  53. Melissa says:

    This worked perfectly and was exactly what I was looking for. I wish Google would offer this natively instead of forcing people to forward the email to an SMS address. Thank you very much for taking the time to post these steps. Your instructions were great!

    • Shunmugha Sundaram says:

      You are most welcome! Happy that you found it useful. Yes, if it was natively available it would have been awesome. Hope you won’t mind sharing and giving a like to the article ;)

      • Melissa says:

        Sorry, but I don’t use Facebook due to privacy concerns, so I posted here to say thanks. If I run into anyone else looking to solve the email-sms alert dilemma, I will of course refer them to this page. :)

        • Shunmugha Sundaram says:

          Hmm. Thanks! But do share in Twitter or Google Plus or in any social network in-case you are in any ;)

  54. Ajit says:

    Hi shanmugha

    days togther I struggled to get nested/threaded emails as sms. tried multiple steps… all failed. later…. I thought if i keep every minute polling of my spreadsheet plus if i separate ( or fool the system…) the incoming nested/threaded emails (all from same sender)… by adding another condition to my filter so that the mail is picked by goo doc as an event and also is polled by google drive within seconds ( usually so) and simultaneously (soon after in milliesecs) get disposed of from my inbox ( either get deleted or archived). that the nested emails get polled separately.. I might be succeeding… hence i added other criterias to my filter labelled”sendsms”, as….
    1. never send to spam
    2.always mark important
    3.skip the inbox…. and created the filter.

    although i did it and succeeded , i still dont know… how the mail can be polled if it has escaped or removed from inbox upon arrival…. or the polling is more frequent than the published every ” 1 minute….. given lowest choice”.

    somehow the problem has got solved….for nested mails.

    all problems have atleast one solution…

    keep up the good work..

  55. tamilmaran says:

    is it possible to send sms of email content,
    any body share the script…

  56. Ajit says:

    Hi Shanmugha

    Iam having a peculiar problem…. a ghost work like!!

    I deleted (my email example ajit@gmail.com)my google calender events, stopped notifications ie no sms, no popups,no email…(mobile no still is registered)… kept my calender name as “hi”(without quotes)…. in short no further event registration shud happen… then i deleted the google spreadsheet that was created from your link for “sendsms”….. so polling of my calender named “hi “…. also shud stop…

    I deleted all labels ,filter, no forwarding of my email(ajit@gmail.com)..

    still a particular senders email reaches me as SMS with the calender name “hi” also in sms….I was shocked….. Any ghost memory is there for the previously created google drive and calender utilities..
    i dont know… can u suggest how to solve this…. how can i delete my calender entrirely.. is it possible…. i cannot change or delete my email account…?..

    regards

  57. Hareesh says:

    Hii Shanmugha, i have been trying to follow what you have typed above, but i don’t understand why is this not working properly for me. So, can you please help me with a video(the entire process) and share it, so that not only me, any one can easily follow it and get benefited from this.
    Waiting for ur reply.
    Thank you

  58. Hareesh says:

    Hii shunmugha, i have tried the code given by you above, i don’t know what’s wrong with my spreadsheet i am getting a weird email everyday morning stating that:

    “Your script, Copy of Send SMS – Techawakening.org, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.
    The script is used by the document Copy of Get Free SMS alerts for New Incoming Emails on Gmail – Techawakening.org.
    Summary:

    Error Message Count
    Authorization is required to perform that action. 341

    etc………..”

    although i have granted it full access, but still i am getting it and even the mails are not going into the spreadsheet or the calendar. So could you please just give me the exact and proper code so that i don’t face any problem from now onwards(sender name, mail subject, receiving time should come to my mobile)… my email id is: venkataharish13@gmail.com. So, please send me even the correct instructions. I hope its not a burden for you.
    Thanks a lot. Waiting for ur reply..

    • Shunmugha Sundaram says:

      Hareesh,

      There is nothing wrong in the code because it is working for everyone. Delete all the existing sheet. Make a new copy. Authorize and create the triggers properly, keep the polling time for say about once per 5 minutes. Then for the first time alone run the function manually from Run menu.

      • Nikola says:

        I had this error message several times, too. And I did as you said: delete all the sheets, make new copy and authorize and create the triggers. And, about 2:30 AM (CET) I usually receive messages from google that there were errors while executing script. And usually the error messages are like Hareesh’s. But, I yesterday received different message:

        Error Message: We’re sorry, a server error occurred. Please wait a bit and try again. Count: 3

        Details:
        Start Function Error Message Trigger End
        10/12/12 4:08 PM sendsms We’re sorry, a server error occurred. Please wait a bit and try again. time-based 10/12/12 4:08 PM
        10/12/12 4:27 PM sendsms We’re sorry, a server error occurred. Please wait a bit and try again. time-based 10/12/12 4:27 PM
        10/12/12 4:49 PM sendsms We’re sorry, a server error occurred. Please wait a bit and try again. time-based 10/12/12 4:49 PM

        Can you understand from these messages what’s going on. Thank you… Nikola

  59. Hareesh says:

    Finally its working.. Thanks a lot shunmugha. Is there any way where i can also get the first few lines of the mail that i receive??

  60. chung says:

    I change have pop3 checked by gmail so I change the:

    var label = GmailApp.getUserLabelByName(‘sendsms’);

    to:

    var label = GmailApp.getUserLabelByName(’2nd.Mail’);

    Also, create label in Gmail is 2nd.Mail, accordingly. All the step I follow instruction, strictly, but it’s not work. It’s send the error to mail as following:
    “Exceeded maximum execution time”.

    Any suggestion?

    Thanks

    • Shunmugha Sundaram says:

      You might have exceed the allocated quota. Wait for sometime and re-try.

      • chung says:

        May be my situation like R in this thread “http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-1622″.

        So, could you email me what you sent to R, in order I try if it working?

        Thanks and best regards,

        Chung

        • Shunmugha Sundaram says:

          But for R it was a different kind of issue. He was able to get notification on creating manual reminder but not when created programmatic-ally. I guess he did not receive any kind of error message like the one you are getting.

          • chung says:

            Thanks for your reply.

            My trouble seem be from the filter. If I mark it to the label without “Skip Inbox” (Mark to the label only, leave it to Inbox), I can receive the SMS. Now, checking more.

            Regarding to “Exceeded maximum execution time”.
            It’s happen when the script take long time to execute (likely, when I click the “Run” button it’s take long time to “Running function sendsms…”).
            Specially, when I change the code then run to test, then it happen. Anyway to solve it?

            Thanks.

  61. chung says:

    Shunmugha Sundaram, thanks for your reply.

    But what is allocated quota for? And it’s not working (I has not received any SMS, until now)?

  62. Itachi says:

    How do I add my phone number havn’t found anything to put it in…

    Thank you for your help

    • Shunmugha Sundaram says:

      It must me configured in Google Calendar. I have mentioned the link to the tutorial in step 1.

  63. Rokey says:

    I like your article.
    i use it.
    can you add subject , sender and full massage ?
    please add it and give it

  64. veera says:

    Hi,
    thanks for your app, can it be possible to send emails depending on some value to be send to an assigned mobile number (different mobile numbers linked to different variables.)

    • Shunmugha Sundaram says:

      I believe you can only link one mobile number in Google Calendar so it is not possible.

  65. kunjal says:

    Hi,
    am seeing there are lots of modifications in comments list.
    So, its a request to Mr.Shunmugha Sundaram to please update the fine working script in the setup instruction.
    thanks.

  66. Vikas says:

    Hi Shunmugha,

    I am facing some issue while configuring sms alerts.

    Have completed successfully till point 4 of step 3 “Configuring Google Docs To Poll for New Incoming Emails”.

    After saving the trigger in point 4 of this step, am not able to find authorize tab so that can move forward.

    Please help.

  67. emmy johanson says:

    one thing…. is the notification instant.. when a new mail has arrived in my inbox.. after how much time will i be notified….??

    • Shunmugha Sundaram says:

      Most of the time it’s instant but every much subjected to network traffic at the given time.

  68. Joe says:

    Hi,

    I have been using this script for several months now and I think it is excellent.

    Just one minor question, is it possible to:

    Automatically delete the calender events?
    OR
    Put all the events in a secondary calendar?

    I use my calendar a lot, and sync with my phone and outlook at work so I keep getting reminders in addition to the SMS. Using a secondary calendar or deleting them before they sync will minimise this issue.

    Thanks,

    Joe

    • Shunmugha Sundaram says:

      Thanks for your suggestion. Yes I have already come up with a fix for it by using a secondary calendar. Will soon update the code :) Do spread the love by sharing this article on social network if you liked it.

    • Shunmugha Sundaram says:

      Hi Agartine,

      I have released a new version.

      - To fix duplicate SMS issue.
      - To create reminders in separate calendar and not in default.

      Start over again with new one. Test it out and let me know the results please.

  69. Joe says:

    By the way.. one thing I learned recently…

    I have 25,000 e-mails in Gmail. Of which only 330 DO NOT contain the word unsubscribe. I have therefore set my sms filter to pick up all e-mails that do not contain the word unsubscribe.

    This ensures I mostly get only personal e-mails, with a fairly small number of exceptions.

  70. emmy johanson says:

    i have done set up acccording to the instructions provided stil not getting any notifications . has any1 faced the problem erlier …. wat can be the possible problem or mistake??

  71. JEEVAN says:

    It’s not working please reply

  72. Iar says:

    Great stuff!
    But i get over 4 SMS and reminders to gmail.

  73. John Patrick says:

    Hi Shunmugha Sundaram, Thank you so much for this tip. It really helps. i have only one problem. The SMS do not stop, even after I delete the email.

    The SMS messages keep comming every 3 min or so.

    How can I limit the test messages to just one or two when the email hits my Gmail account filter? Thank You.

    • Shunmugha Sundaram says:

      John,

      Welcome :) Do share this article. No of SMS you get is determined by number of reminders created in Google Calendar. If you are getting more SMS for a single reminder it might by due to network latency. But code does not pick up the same email twice because once it has read the email it deletes the label associated to it so it does not pick the same message the next time.

      Any how I will try looking into code again :)

    • Shunmugha Sundaram says:

      Hi Agartine,

      I have released a new version.

      - To fix duplicate SMS reminder issue.

      Delete the old project and start over again with new one. Test it out and let me know the results please.

  74. Jayaprakash says:

    Hello Brother Shunmugha Sundaram,
    I am receiving sms notifications only for some mails. For instance, if I get 15 mails a day, I receive sms notifications only for 3 or 4 mails. Kindly help.
    Regards,
    Jayaprakash.

  75. dino says:

    hi..i followed ur steps n i m receiving sms alerts .then i wanted to receive sms alerts wiht sender id ..so i used the updated spread sheet ( i copied it ).i didnt recive sms alert wiht sender id..do i hv to deactivate the previous trigger (the trigger used in the previuos spread sheet ) ?

    • dino says:

      i m not receiving sms alerts :(

    • Shunmugha Sundaram says:

      Cross check in Google Calendar if reminders are being created. Preferably deactivate trigger in old sheet since you are not using it now.

      • dino says:

        thanks fr the reply ..i checked calender.reminders are created as events.yesterday i clicked run in the script editor .from then sms alerts are coming :)

        one doubt : how do i identify the old sheet ?in the drive,i can see 3 titles named as “copy of get free sms alerts fr new incoming mails in gmail-techawakening.org ” with 3 diff updated timings .

        what does indicate ?

  76. Sudeepa says:

    Hey Shunmugha Sundaram
    The script works fine. Can u alter it so that it displays only the subject of the email. i.e without the senders email or sent time….

  77. E. Thiagarajan says:

    Dear Frnd,
    Thanks for tip..
    But I can’t get the alert..
    Plz guide me…
    with reg,
    E. Thiagarajan

  78. E. Thiagarajan says:

    Dear Frnd,
    Thanks for your response..
    I followed your instructions but the mail alert is not comes to me..
    Shall I give my user id and password to you? (I trust you) can you do it for me that alert activation to me?
    Friendly your’s
    E. Thiagarajan
    9894838267

    • Shunmugha Sundaram says:

      This won’t be necessary as you seem to have got it working yourself. Way to go!

  79. E. Thiagarajan says:

    Dear Frnd,
    HAPPY DIWALI TO YOU AND YOUR FAMILY MEMBERS.
    with reg,
    E. Thiagarajan
    9894838267

  80. E. Thiagarajan says:

    Dear Frnd..
    I got it..
    Thanks for your tip…
    Once again I thank you..
    with reg,
    E. Thiagarajan.

  81. E. Thiagarajan says:

    Dear Frnd,
    Now I got this type of msg…
    Plz guide..

    Your script, Copy of Send SMS – Techawakening.org, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.

    The script is used by the document Copy of Get Free SMS alerts for New Incoming Emails on Gmail – Techawakening.org.

    Details:

    Start Function Error Message Trigger End
    11/12/12 6:43 AM sendsms Service using too much computer time for one day time-based 11/12/12 6:43 AM
    Sincerely,

    Google Apps Script

    Need help? Visit the Google Apps Script documentation. Please do not reply to this message. (c) 2012 Google

    • Shunmugha Sundaram says:

      Increase the trigger time to say about every 5 minutes. Because if triggers time is set to low it will consume lot of resource that is the cause of this problem.

  82. Manish says:

    I am following all the process properly, but keep getting this error

    Our systems have detected unusual traffic from your computer network. Please try your request again later.

    Any Idea, what can be wrong?

  83. Mark says:

    Thanks for this, it’s really great!

  84. zmyest says:

    Shunmugha Sundaram: I have been using this for a while now.everything works fine so far.
    but, from the last 4,5 days i am not getting reminders.
    I didnt understand wat could b the problem?
    btw, I just rename the google calenders name as mention in the comment.

  85. prathamesh says:

    Hi Shunmugha Sundaram,
    Thanks a lot for this code but issue i am facing is although its sending sms alerts it gives alert for 1st mail although its old. can it be made in way that if alert for that mail is given before it should not repeat

  86. adamico says:

    Hi.
    Is there any way, how to automatically stop sending sms during night please ?

    Thank you !

  87. E. Thiagarajan says:

    Dear Frnd..
    Hope you fine there…
    Plz clear my doubt..
    Can I get mail alert for YAHOO mails like the same..?
    Waiting for your reply..

  88. Pardeep says:

    Keep going.
    Great! It works. : – )

  89. alex says:

    Can I receive also in the sms notification partof e-mail body??

    I know that I will not be able to receive whole body because Google imposes limit on the length of the SMS.. but short part of body would be not possible? it will very helpfull..

    Thanks!

  90. Arun Ganesh says:

    Hai Mr. Shunmugha Sundaram! Who are you man? Just awesome! Thank you for this great work!

    • Shunmugha Sundaram says:

      Arun,

      You are most welcome buddy. Don’t forget to share the article on social networks. Me? Just another guy in the web ;)

  91. Chaavadi says:

    Hi,
    I tried this on my google documents. but its creating a new event for each one minute for the same old mail. I hope you wil guide me in finding the upadated script. But really this is very great script
    yours faithfully
    Chaavadi

  92. Neil says:

    This works for me except I have the same problem as others here have. I get 2 or 3 SMS alerts for each email received. Is there any way to ensure only one SMS message is sent for each incoming email?

  93. samyadh jain says:

    function sendSmsAlerts() {
    var label = GmailApp.getUserLabelByName(‘text forward’);
    var threads = label.getThreads();
    var now = new Date().getTime();
    for(i in threads){
    CalendarApp.createEvent(‘IMP- ‘+threads[0].getFirstMessageSubject(),
    new Date(now+60000),
    new Date(now+60000)).addSmsReminder(0);
    }
    label.removeFromThreads(threads);
    }

    this script is enough to get that done

  94. Pradeep says:

    Hi,

    I did as per your guidelines.
    I am not getting alerts.
    How come ?
    Please help.

    Regards

  95. siddhart says:

    Hi Shunmugha,
    I am getting a truncated sender email id.
    Any fix for that

    Regards
    sid

    • Shunmugha Sundaram says:

      It might be due to character limits imposed by Google. Longer the subject there is a chance of email being truncated.

  96. Gaurav Mittal says:

    Hi Shunmugha

    Thanks for the post. It did work !

    However, this only gives the notification that an email from XYZ has come. Is it also possible to give the body of the email (the text in the email in sms)?

    • Shunmugha Sundaram says:

      That won’t be possible because of constraints imposed by Google on message length.

  97. Hareesh says:

    Hii shunmugha, you promised that you will be making a video of the entire procedure so that people can easily understand this. I am waiting for this. By when are you going to do so??
    Thank you

  98. Hareesh says:

    Thanks a lot.. Me and my friends are anxiously waiting for your video so that atleast by following that we can properly get alerts to our mobile without any errors/problems.. Hope you will show everything clearly.. Thanks again.

    • Shunmugha Sundaram says:

      Could you please tell me at which step you are finding it difficult to follow. I will help you out.

  99. Hareesh says:

    Sure.. I usually get two to three alerts per day, thats it. I have copied the same code what u have given above, i don’t understand whats the exact reason for this. I usually get many facebook mails, but i never get them through sms alerts. So, its my personal request to u to just paste the correct code here / else mail it to me – if possible..(as there are many modifications above – i don’t know which one is the correct one as i am not a CSE student) so that it works perfectly. Thanks a lot. This was the reason why i am insisting on video so that i can check where i have gone wrong..

  100. Fahad Zaman says:

    I was following your tips, in 3.5 you said “Click Authorize and then grant access” but I didn’t find anything named “Authorized”!
    What can I do? I really need this system to get sms for a new email in gmail.

    In comments I can see there are lots of code. Can you tell me which one ic correct?
    Please replay me. You can comment back the working code. Thank you. :)

    http://fahadzaman.yolasite.com/contact.php

  101. Margeret Otolo says:

    This may be a silly question but how do I let Google know what my phone number is to get the SMS message sent out?

  102. dhana says:

    i am receive late sms alert (5 hour’s late)
    what the meaning of this,

    can u help me, thnks
    Your script, Copy of Send SMS – Techawakening.org, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.

    • Shunmugha Sundaram says:

      It is due to high resource usage. Just increase the time of trigger. Set it to hourly basis.

      • dhana says:

        i will give it a try

        tnks for early replay

        after i will get back to u how it works

      • dhana says:

        not works i receive below message in my inbox
        can u help me out, cause its very important to me
        tnks
        Error Message Count
        Exceeded maximum execution time 2
        Service using too much computer time for one day 22

        • Shunmugha Sundaram says:

          Please refer my previous comment:

          http://techawakening.org/free-sms-alerts-new-email-on-gmail-with-google-docs/1130/#comment-4834

  103. Elan says:

    Thanks a lot ! it works great

  104. john says:

    hi, what could be the reason that i am getting 2 SMS notication everytime for incoming email in sendsms label.

    my google calender have only 1 reminder set i.e SMS 10 min.

    • Shunmugha Sundaram says:

      John,

      I have logged a defect for this issue yesterday. Will keep you posted.

      https://code.google.com/p/google-apps-script-issues/issues/detail?id=2353

    • Shunmugha Sundaram says:

      Hi Agartine,

      I have released a new version.

      - To fix duplicate SMS issue.
      - To create reminders in separate calendar and not in default.

      Use the latest one. Test it out and let me know if it worked out.

  105. fred says:

    Hy Mr. Shunmugha Sundaram!
    You are just awesome!
    A big thanks from France for this great work!

    I just modified a little bit your work, because I didn’t want to receive a sms from 9am to 18pm ;-)
    Maybe there another way, but I’m not a “computer programmer”…
    One question nevertheless: I removed “for(i in threads)”, I doesn’t understand the meaning of this line. And as I receive 2 sms for the same mail, I believed it was the cause, but not I still receive 2 sms, strange ;-)

    ——
    function sendsms()
    {
    try
    {
    var label = GmailApp.getUserLabelByName(‘sendsms’);
    var threads = label.getThreads();
    var now = new Date().getTime();

    var GMTtime = new Date().getUTCHours() + 1; /* I’m in GMT+1 */

    if ( (GMTtime >= 9) && (GMTtime <= 18) )
    {
    CalendarApp.createEvent(threads[0].getFirstMessageSubject()+": "+threads[0].getMessages()[0].getFrom(),new Date(now+60000),
    new Date(now+60000)).addSmsReminder(0);
    label.removeFromThreads(threads);
    }
    }
    catch(err)
    {
    }
    }

    • Shunmugha Sundaram says:

      Welcome. That’s great! It’s probably a bug, I have raised a defect addressing that issue. Please refer my previous comment. Do share this article with your friends ;)

    • Shunmugha Sundaram says:

      Hi Agartine,

      I have released a new version.

      - To fix duplicate SMS issue.

      Delete the old project and start over with new one. Test it out and let me know the results please.

  106. Newby says:

    Very good tip; I no longer have to check my email compulsively. Thank you for your script.

    Although the code always picks up my emails and seems to be working smoothly, I am getting two SMS alerts per email instead of one.

    At first I assumed this was because I get two SMS notifications per calendar event, one the day before and one a couple hours before. I changed these settings so that I would only receive one notification per event; nevertheless, I have continued to get two texts per email.

    I browsed the comments and it seems that John Patrick may have had a similar problem. Do you have a solution to this yet? I am getting exactly two notifications per email, never more or less. This has been going on since I installed your script about a week ago, so it is not caused by any temporary latency. The two texts that I get are usually spaced two to three minutes apart. (Occasionally they will be one minute apart, occasionally four.)

    Is there anything that I can do that will fix this problem?

    • Shunmugha Sundaram says:

      Newby,

      Thanks for those words! I am looking into that issue. In fact have raised a defect for it. Please look into my previous comment. Will keep you posted if any thing turns up :)

      By the way do share the article on social networks if you liked it ;)

      • Newby says:

        All right, thank you for looking into it! I will share this article with my friends as soon as the bug is fixed. :)

        If it helps at all, I’m running the latest version of Chrome.

        • Shunmugha Sundaram says:

          Hi Agartine,

          I have released a new version.

          - To fix duplicate SMS issue.
          - To create reminders in separate calendar and not in default.

          Delete the old project and start over again with new one. Test it out and let me know the results please.

          As you said do share it if the issue is fixed ;)

          • Newby says:

            I deleted my old script and downloaded the new one as linked to in the instructions in the post, but I’m still getting two texts per email. :(

          • Shunmugha Sundaram says:

            Not sure why. Because when I test it out, with new fix duplication issue seems to be resolved. Could you please cross check again in-case two reminders are being created in Google Calendar.

  107. Agartine says:

    Awesome workaround, I had for years dreamt of this but never knew it was possible. I set this up a week ago and applied the label in such a way to get sms only when it’s my boss sending the email, and it’s working greatly.

    I don’t mind receiving the sms twice, but if you ever find a way to eliminate it, it’ll be great.

    A question though, in order for this code to work, it is creating reminder events in the calendar, and that is frustrating for me, is there a way to clear the event from the calendar after the sms is sent?

    Thank you again!

    • Shunmugha Sundaram says:

      Agartine,

      You are most Welcome. Happy that you found it useful. I am working on duplication issue. As far as reminder being created in default Calendar it will be addressed in next code update. After which it will be created in separate Calendar. Probably I will be updating the project and publishing it this weekend. You can make use of it.

      Do share this article if you found it useful :)

    • Shunmugha Sundaram says:

      Hi Agartine,

      I have released a new version.

      - To fix duplicate SMS issue.
      - To create reminders in separate calendar and not in default.

      Delete the old project and start over again with new one. Test it out and let me know the results please.

      Mean while share this article if you liked it! ;)

      • mark says:

        where is the new version?

        i cannot get this to work using just the instructions above (not including the comments). the comments are long and with many important pieces of information spread out. it would be great to see it all in one place. thanks!

        • Shunmugha Sundaram says:

          Hi Mark,

          The new version is mentioned in the step 3.2. There is a link. Let me know what problem are you facing in setting this up so that I can help you out. Following the instruction as it is should be more than enough.

          • mark says:

            Hi Shunmugha,
            Thanks for replying and for writing this wonderful code. Now if i can only get it to work! I have everything set up properly now and tested it by creating a new filter that sends SMS alerts whenever messages are received from my YahooMail account. However, this suddenly stopped working when i changed the Gmail filter to “mark as important” as well as “apply label: sendsms”. i will try deleting these filters and creating new ones that only “apply label: sendsms”. Is this a bug perhaps?

            Thanks and best wishes,
            Mark

          • Shunmugha Sundaram says:

            Hi Mark,

            Thanks for those words. Ideally it should work. To be frank I haven’t tried such a scenario yet so would try it and let you know what turns up. Mean while you can create new filter and try it out.

            Do share this article if you liked it ;)

          • mark says:

            Hi again (read comment below first, as it is older),
            another problem is that the label ‘sendsms’ seems to be automatically removed once the SMS has been sent. is that supposed to happen?

          • Shunmugha Sundaram says:

            Hi Mark,

            Yes it’s a expected behavior the label would be removed to indicate that the email has already been processed.

  108. someone says:

    This looks impressive, but sadly doesn’t work for me. after authorization keep getting: “Our systems have detected unusual traffic from your computer network. Please try your request again later.”

    • Shunmugha Sundaram says:

      That’s bad. Probably your system is infected with Malware of some sort.

      Please refer this article: http://support.google.com/websearch/bin/answer.py?hl=en&answer=86640&rd=1

  109. Aditya says:

    Many Appreciations,
    Very Useful & Lifesaver at times
    I was hoping that if you could explain the script line by line along with other options that could be added would help us to customize the script as per need.
    We know that you have tried your best but it is a bit scattered, should I say.

  110. Munna says:

    Thanks Shunmugha Sundaram …..This is highly appreciated…I think if you make a video on it and post in youtube that would be best……This is amazing …i believe ideas like this are plenty in you :)

  111. alphy says:

    how to set sms remainder for only unread mails ????????

    • Shunmugha Sundaram says:

      You need to tweak the code a bit for that.

      • alphy says:

        how should i change it,,pls do rply….
        plus i hav been getting multiple reminders for te same mails…..smthng to avoid that will also be great,pls post the code wit abov said chngs

        • Shunmugha Sundaram says:

          I will be adding that feature in next update.

          But now I have update the project to fix duplicate reminder issue. Delete the old project and start over again with new one.

          Mean while share this article if you liked it!

  112. Miljan says:

    Hi, I’ve been getting notifications for my emails, thanks to this tutorial, since December. But it just stopped working a couple of days ago. I deleted all filters, code etc, and did the whole process again, but it still doesn’t work. Anybody else having this problem?
    And yeah, I was getting two messages for each mail, but it was no big deal.

    • Laf says:

      The same problem here. I’ve just notify Oleg through twitter, that the notification stopped couple a days ago. I’ve upgraded google app engine into 1.7.4. version, but still nothing.

  113. Shunmugha Sundaram says:

    test

  114. pithiki says:

    I am getting 2 sms per email too, also is there a way to set quiet hours? so no alert will come during night sleep?

    • Shunmugha Sundaram says:

      Sorry :( This feature is not supported by the current version.

      • pithiki says:

        function sendsms()
        {
        try
        {
        var label = GmailApp.getUserLabelByName(‘sendsms’);
        var threads = label.getThreads();
        var now = new Date().getTime();
        var cal=getCalendar();

        var hour = now.getTime();

        if (hour < 8){
        now = now + ((8*60*60*1000)-(hour*60*60*1000);}// shifts the time so many hours that the schedule is after 8:00
        // so no sms during 00:00-08:00

        for(i in threads)
        {

        cal.createEvent(threads[i].getFirstMessageSubject()+": "+threads[i].getMessages()[0].getFrom(),new Date(now+60000),
        new Date(now+60000)).removeAllReminders().addSmsReminder(0);

        }
        label.removeFromThreads(threads);
        }
        catch(err)
        {
        Logger.log("Error Occured"+ err.toString());
        }
        }

        function getCalendar()

        {
        try
        {
        var cal=CalendarApp.getOwnedCalendarsByName("sendsms")[0];

        if (!cal)
        {
        cal=CalendarApp.createCalendar("sendsms").setHidden(true);
        return cal;
        }

        else
        {
        return cal;
        }
        }
        catch(e)
        {
        Logger.log("Error Occured"+ e.toString());
        }

        }

        i added three lines of code i think should keep me quiet 00:00 to 08:00 any thoughts on them?

        • pithiki says:

          function sendsms()
          {
          try
          {
          var label = GmailApp.getUserLabelByName(‘sendsms’);
          var threads = label.getThreads();
          var now = new Date().getTime();
          var cal=getCalendar();
          var date = new Date()

          var hour =new Date().getHours();// mistyped before
          if (hour < 8){
          now = now + ((8*60*60*1000)-(hour*60*60*1000));}// shifts the time so many hours that the schedule is after 8
          // so no sms during 00:00-08:00

          for(i in threads)
          {

          cal.createEvent(threads[i].getFirstMessageSubject()+": "+threads[i].getMessages()[0].getFrom(),new Date(now+60000),
          new Date(now+60000)).removeAllReminders().addSmsReminder(0);

          }
          label.removeFromThreads(threads);
          }
          catch(err)
          {
          Logger.log("Error Occured"+ err.toString());
          }
          }

          function getCalendar()

          {
          try
          {
          var cal=CalendarApp.getOwnedCalendarsByName("sendsms")[0];

          if (!cal)
          {
          cal=CalendarApp.createCalendar("sendsms").setHidden(true);
          return cal;
          }

          else
          {
          return cal;
          }
          }
          catch(e)
          {
          Logger.log("Error Occured"+ e.toString());
          }

          }

          be sure to check at gogle script editor , project properties , info , timezone settings….

  115. Radhakrishnan says:

    I have followed all the above procedure.. bt i cannt get any notification from Gmail.
    can u pls help me to sort out of this…

  116. David says:

    great work! – but I can’t make it work for me….
    I have done everything like you say here – I can see all my mails get the label “sendsms”.
    I can see there is a script in google docs- but even if I run it – I don’t get any SMS.
    is there any logs? maybe I can see there where is the problem?
    what can be the problem?
    Please help,

    Thanks

    David ‘

    • Shunmugha Sundaram says:

      Could please go to Google Calendar-> Setting-> Calendars. Then for calendar sendsms, check show in list. Now click on the calendar and see if reminders are being created.

      • David says:

        yes I can see that I have 900 reminders on the 19.2.13(yesterday) , and 4100 reminders on the 20.2.13 (today).
        but when I sent myself an E-mail ,I still don’t get the SMS.
        I have total of ~16,000 E-mails, maybe this is the problem?

        • Shunmugha Sundaram says:

          ~16,000 emails tagged to the same label?! Probably yes that could be the reason. There is quote limit to number of SMS that Google can send your per day.

          • David says:

            mmmm…. I thought so
            so I have change the filter to work when I get mail from me.
            do I need to wait to tomorrow,to see if it’s work?
            or can I do something to change it now?
            thank ,

          • Shunmugha Sundaram says:

            Delete the old project. And see to that the label is tagged only to lesser number of emails. Start over again tomorrow. As suggested earlier see if the reminder is being created in calendar. Most importantly see to that you have correctly linked your phone to Google Calendar.

  117. David says:

    I have remove all the files and scripts in the Google Docs
    and start over.
    make a new filter to only message from me, so I have only 3 of them.
    I can see the phone is connected to gmail – calender :
    “Phone number successfully validated”.
    still not working .
    also I have created an event at the calender for tomorrow – I can see it in green line .
    but I even doesn’t get this as a SMS.
    so maybe this the problem?
    (or should I wait some more?)

    Thanks ,

    • Shunmugha Sundaram says:

      So you mean to say you are not getting alerts even if manually creating reminders in Calendar?

      Click create button on left enter some reminder, set time and calendar. Finally in reminder option select SMS and save it. Do this and please let me know it you are getting notification on phone.

      • David says:

        I have done this – and it’s work.
        then I have try with the mail – and it’s working .
        Maybe the problem was when I try to make it work with all the inbox (16,000 e-mails) and google need time to “relax” :-)

        now it’s working great ,
        Thank you very much – good work!

        Thanks ,

        • Shunmugha Sundaram says:

          David,

          And finally! Awesome. Please do share this article on social networks if you won’t mind ;)

  118. Mantu Sarker says:

    Dear sir,

    I am using this trick on my email successfully and every time I get notified in my mobile via SMS. But I will be very happy to you if you can add an extra option which allows us to receive SMS with the contents(only text)inside Email body.

    Sir, if it is possible pls inform me.

    Have a good day!

    • Shunmugha Sundaram says:

      Sorry, it’s not possible as there is message length restriction imposed by Google. :(

  119. Jerald says:

    Hi there,

    I tried out your method and it works very well, thank you for that.

    My only problem is that due to some special Hungarian characters (á, í, ó, ő etc) the message sent by Google get limited to 70 characters, which makes all messages cut into half.
    In other words I get the entire notification message but in two pieces, the second part following the first one in a matter of seconds.

    Is there a workaround to fix this and have a single notification message?

    Cheers.

    • Jerald says:

      Maybe if the script changed those characters to normal ones (á->a, í->i, ó->o, ő->ö, ú->u, ű->ü) and created the calendar entry with the new content?

      Is it possible to you add those rules to the script?

      • Doing so will make things complex and isn’t effective too.

        • Jerald says:

          Getting two messages instead of one is a bit annoying and also reduces the number of instances people can get alerts due to the limit of the daily number of messages sent. :( All in all I believe it’s worth the trouble.

          Though I’m not familiar with scripts with a little help from you I might as well well do it for my personal use.

          So my only question is; where to write what in the code? :)

          • The logic is to use replace function to swap character.

            EG: threads[i].getFirstMessageSubject().replace(“á”,”a”)

          • Jerald says:

            Thanks a lot, it does work! :D

            However, it only replaces the first occurrence of a given letter, so if the subject contains another letter of “á”, the script will leave it unchanged.

            Any ideas how to fix this?

          • Great. Then change it as follow it will replace all occurrences..

            threads[i].getFirstMessageSubject().replace(/á/g,”a”)

            Finally, if all worked out just don’t forget to share this article on social networks. Hope you won’t mind it ;)

          • Jerald says:

            Cheers mate. :)

            I’m already sharing it. ;)

  120. Muhammad Arsalan says:

    Little bit tweak on code script is no 100% working for me,

    cal.createEvent(threads[i].getFirstMessageSubject()+”: “+threads[i].getMessages()[0].getFrom(),new Date(now+60000),
    new Date(now+120000)).removeAllReminders().addSmsReminder(1);

    btw Thanks, great mind

  121. Jerald says:

    Strange, but with the very same code I get sms notification from one account but don’t or rarely get sms from another one.

    Everything is the same, the calendar event and timed notification get created yet there is little to no notification from one of my accounts.

    I even deleted to linked Google Doc and started from scratch. :(

    What can I do?

    • Jerald says:

      One more thing. Of about 80% of the emails I get double notifications; I get the SMS then within a one-to-five-minute window I get another one with the same content.

      I’m using your latest updated script (with the possible solution for this problem) yet getting duplicate notifications.

      Checking calendar entries shows that the script works fine; only one reminder set for each event.

  122. Piyush says:

    I have tried the above steps starts from 2.) Creating filter condition and linking to Label in Gmail as I need an sms alert as soon as a mail come to my gmail id.

    But its not working I am not getting any sms alert please help……

    I am asking this question to all particularly “Shunmugha Sundaram”.

    I need it badly…..please help me….

    thx
    Piyush

  123. QASEM says:

    than you
    But it dosn’t work In Iran
    google coundn’t sending Verification code me

  124. leif says:

    hi Shunmugha
    Very nice script. thank you a lot.
    I have two problems:
    Sometimes I still get two sms also with your updated version above.

    But another thing is, that the sender sometimes is my own email adress. i think this happens when the sender directly answers a message sent by me and the email contains still my original message with me as the sender somewhere.
    Do you understand what I mean? And is there a way to fix this?

    thanks,
    leif

  125. leif says:

    hi Shunmugha
    Thanks for your will to help. You are right, it isn´t so easy to understand what i have written.
    Another try:
    The sms should give you the senders email address, right?
    But sometimes I don´t get the senders email address but my own email address. Thats the problem.

    My thoughts about how this maybe could happen was, that the email the sender send to me is an “direct reply email”. (replying to another email I had written to the sender before.) Which means that in the header or somewhere else in the email my own email address as a sender is still there. (Because replying to an email copies all the information the original email contains.) This maybe could make your script mistakenly “think”, that I am the sender of the email.
    Is it clear what I mean now?

    • leif says:

      I made more tests according to this issue.

      If anyone just replies directly to an email, your script uses the wrong sender. (It uses the sender of the original message, who is of course you)

      But if anyone replies directly but changes the subject for just one character (for example changing “Re: This is a test” to “Re: This is a test 2″) everything works fine.

      Maybe this helps to fix this issue.

  126. Ali Ramzan says:

    Some time its work and some time fail to send messages.

  127. Mohamed says:

    Hi from morocco this is a great tip thanks men it’s work

  128. jay says:

    Grt work dear… is was searching it from years. just too gud.

  129. Sagar says:

    I want the sms notification, in case if the specific email is not sent. How can i do that?

  130. Nathen says:

    Hi can you clear something up for me the following expression
    threads[i].getFirstMessageSubject()+”: “+threads[i].getMessages()[0].getFrom()
    appears to give me the sender of the first message in the thread which is the first message received. How can I change this to the last message received in the thread.

    • Actually threads[i].getMessages()[0] refers to the most recent/latest message from the sender.

      If you want the oldest one you can do like this. Find the length of that thread and then make reference via that.

      EG:

      var length= threads[i].getMessageCount();
      threads[i].getMessages()[length].getFrom();
      threads[i].getMessages()[length].getSubject();

      Please try and let me know. Hope it helps. Do share this article :)

  131. Nathen says:

    I get the following error
    “[13-04-28 21:44:55:412 PDT] Error OccuredReferenceError: “i” is not defined.”
    Code is
    try
    {
    var label = GmailApp.getUserLabelByName(‘sendsms’);
    var threads = label.getThreads();
    var now = new Date().getTime();
    var cal=getCalendar();
    var length= threads[i].getMessageCount();
    for(i in threads)
    {

    cal.createEvent(threads[i].getMessages()[length].getSubject()+”: “+threads[i].getMessages()[length].getFrom(),new Date(now+60000),
    new Date(now+60000)).removeAllReminders().addSmsReminder(0);
    Thanks for your help

    • Nathen,

      Place var length= threads[i].getMessageCount(); within the for loop because scope of the variable i exists only within that.

      • Nathen says:

        Shunmugha I have to admit I have a very limited knowledge of java I have tried to do what you suggested but have not been able to figure it out could you give and example

  132. john says:

    hi Shanmugha,

    First off all , i thank you for good solution.

    The problem i have is that, i get weekly notification from google about script failure. ( I setup weekly notification ). What i would like to know here is that what will be the worst case. I understand that google finds usage of high system resource usage and it terminate the script execution and we get failure notification. But my question is , for how long google stop script execution if it finds high resource usage. My script querry sendsms label every 1 min. if google stop script execution. will after 2min. my script execute again and alert me if i have email.

    How long the execution stopped by google if it sees high resource usage.

    Thanks,
    John.

    • John,

      The limitation is based on per day limits. If you exceed the quota for the given day you will not be able to access the services till next day.

      More about the quota limits: https://docs.google.com/macros/dashboard

      By the way do share this article on the web if you liked it ;)

      • john says:

        Shanmugha,

        Is this what matters..
        Triggers per script, per user 20 20 20
        Trigger Aggregate Execution Time 1 hours / day 3 hours / day 6 hours / day

        I am using google apps business. can u explain what that 20 means. In my case, triggers i set is every 1 min. then it means after 20 min. my quota gets over?

        • John,

          It means a Script is allowed to have at the maximum of 20 triggers assigned to it. Our script has one only so it’s not a problem.

          • john says:

            shanmugha,

            Thats make sense. Then what action’s quota in that link you are refering which will have impact on our script.

            Thanks,
            John.

          • It’s number of time the request is made to API. In your case number of ‘GMail Read’ action would be the reason for it.

            To solve this problem simply increase the polling interval.

  133. hemanth says:

    hi shanmugham , first of all i would like to congratulate u on ur nice trick its simply superb but i have a small issue and was wondering if u could help me to resolve it , i receive the notification only once per day for the first mail of that day only , if in case any second or third mail arrives for the day it only shows that the mail has arrived by displaying it in the column of google calendar but doesnt forward the same to my mobile no and i wont receive any notification for the same pls help me to solve this issue .

  134. john says:

    shanmugha,

    Thanks for your reply.
    GMail Read 10000 / day 10000 / day 10000 / day

    as u see gmail read is 10000 per day. In my case i set every 1 min = 60 times an hour = 1440 a day. which is 1:10. then any idea why google saying resource usage. I dont use the config email for any other purpose.

    Thanks,
    John.

  135. Saquib says:

    First, thank u guys this is gr8.
    Second, it only shows the Sunject line, isnt there a code that shows even the contents of the Email messages apart from the Subject because that is rather much more important, the content, than the subject itself.
    And Last, can u plzz tell in which language the source code is written???
    It looks like C but i dont think it is C language…
    thanks again.
    Regards

    • Saquib,

      Welcome. Please see the previous/older discussions on why email body could not be displayed. Language used is JavaScript.

      Do share this article on the web if you liked it ;)

Trackbacks For This Post

  1. gmail from android? - Computer Forums

Leave a Comment Here's Your Chance to Be Heard!

*