Skip to content

Instantly share code, notes, and snippets.

@Mashpy
Created March 10, 2013 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Mashpy/5128861 to your computer and use it in GitHub Desktop.
Save Mashpy/5128861 to your computer and use it in GitHub Desktop.
function sendsms()
{
try
{
var label = GmailApp.getUserLabelByName('sendsms');
var threads = label.getThreads();
var now = new Date().getTime();
var cal=getCalendar();
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");
return cal;
}
else
{
return cal;
}
}
catch(e)
{
Logger.log("Error Occured"+ e.toString());
}
}
@mdminhazulhaque
Copy link

Cool job done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment