Note that there are some explanatory texts on larger screens.

plurals
  1. POSMS notification for Gmail using Google Apps Scripts: how to display content of the email?
    primarykey
    data
    text
    <p>I am working on SMS notification each time I receive an email that meets certain criteria; I decided to use Google App Scripts for this.</p> <p>I have been inspired in particular by the following article <a href="https://developers.google.com/apps-script/articles/gmail_filter_sms" rel="nofollow noreferrer">https://developers.google.com/apps-script/articles/gmail_filter_sms</a>. I also checked the related question in StackOverflow <a href="https://stackoverflow.com/questions/12060620/sms-alerts-for-important-mails-in-gmail">SMS Alerts for Important Mails in Gmail</a>.</p> <p>I improved the original script from developers.google.com by cleaning up the events the next time the script is run (I was receiving the SMS alerts each time the script is run). The script is currently working by using the label 'SendText' and creating events in calendar 'AlertSMS'. </p> <p>However the SMS I receive only contain the subject and author of the email: I <strong>need to display the content of the email</strong> (or at least a part of it). I tried with no luck to add it to the description of the event. Anybody got an idea on how to do it?</p> <p>Hereunder, the code of my script:</p> <pre><code>function sendText() { var now = new Date().getTime(); // Delete old events var events = CalendarApp.openByName('AlertSMS').getEvents(new Date('January 1, 2010 EST'), new Date(now-30000)); for (i in events) { events[i].deleteEvent(); } // Get list of emails to set alert for var label = GmailApp.getUserLabelByName('SendText'); var threads = label.getThreads(); // Create new events for emails alert for(i in threads){ var message=threads[i].getMessages()[0]; CalendarApp.openByName('AlertSMS').createEvent('[SMS] '+threads[i].getFirstMessageSubject()+' -from- '+message.getFrom(), new Date(now+60000), new Date(now+60000), { description:message.getBody() }).addSmsReminder(0); } label.removeFromThreads(threads); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload