strain out spam
create calendar events automatically

BASIC STEPS

  1. forward emails from zmail to gmail account (with filters)
  2. when they arrive in gmail – "label" them so they organize themselves into groups
  3. use "google app scripts" to automatically create calendar events from labeled emails
  4. set it to create calendar events whenever the "label" (group) has a new email in it

(just be sure that you are in the same google account for all steps – sometimes it is easier to logout of all of them and just be logged into the one we are working on)

 


STEP 1: forward zmail to gmail (using filters)STEP 2: Set up labels / filters in GmailSTEP 3: Set up google calendar(s)STEP 4: Set Up Google Apps ScriptsEND PRODUCT: Auto Updating Work Calendar

Strain out spam – set up important emails as a calendar event in google calendar

Forward emails to a gmail account (using filters)

If you only forward the actual work messages and leave the spam – it will make it that much easier in the gmail account to see what's what.

  1. Zimbra Settings

    Strain out spam - create calendar events out of work emails automatically.

  1. Create Filters to catch actual emails (and leave the spam behind)

Strain out spam - create calendar events out of work emails automatically.

 

Use a "*"to mean "anything" – so tim@*.com would cover – time@cubik.com, tim@nakedsword.com, tim@falconstudios.com etc.

 

 

Strain out spam - create calendar events out of work emails automatically.

you can also use the filters to categorize these emails in zmail as well

Now that you are moving important emails to gmail – you will label them there

Use Gmail Filters to push events in to correct “Labels” in Gmail

Set Up Filters that push emails into "labels" in Gmail – they are basically just groups.

The gmail filters organize and label the emails as soon as they arrive in gmail. You can make as many labels / filters are you need / want.

 

Set up the filter to catch emails however you need to.

Strain out spam - create calendar events out of work emails automatically.

 

All of these settings are open as well – all that matters is that you give these particular message a "label" – you can make separate labels for each email – or send them all to the same one – either way works.

Strain out spam - create calendar events out of work emails automatically.

 

Just remember the name of the label – you will need it for next steps.

Strain out spam - create calendar events out of work emails automatically.

 

Next set up the calendars you want to populate with these emails / events

 

CALENDAR SETUP

Switch over to https://calendar.google.com – using same google accout as you just did for gmail.

For this step it is probably easiest to make a new calendar for each "zmail / gmail filter" you created – they will all display together on the actual calendar. But doing them separately makes it easier to organize or even turn one off you need to.

  1. hit the "+" by the "other calendars" heading and make a new calendar – perhaps with the same name as the filter – or whatever name makes sense to you

Strain out spam - create calendar events out of work emails automatically.

Then once it is created – click 3 dots – and got to the settings for that calendar

 

 

Strain out spam - create calendar events out of work emails automatically.

then get calendarID

 

Strain out spam - create calendar events out of work emails automatically.

 

Use a simple “Google Apps Script” to create a calendar event out any new item that appears in the “labels”

 

Google Apps Scripts

this script is what will grab the emails out of the “labels” and make a calendar event out of them. It is fairly basic but does more the info into the calendar for you.

then go to https://www.google.com/script/start/ – just make sure you are using the same google account you were in gmail, and calendar with – only this time in apps scripts. You will also need to allow popups – usually you can see the option in the browser bar once one tries to launch – just click it and say "popups ok" from apps.google.com.

 

  1. Hit "start scripting"

  2. then "NEW PROJECT"

    Strain out spam - create calendar events out of work emails automatically.

  3. Name your project

    Strain out spam - create calendar events out of work emails automatically.

  4. Copy/paste the script below into the project pane

    
    function createCalendarEventForLabeledEmails() {
      var labelName = "NSJira"; // Replace with your label name
      var calendarId = "c_e8c4b871ac9ee31a7b1e54f39fbe0bd363c5744784a1075328a446754aa982d1@group.calendar.google.com"; // Replace with your calendar ID
      
      // Get the label and threads
      var label = GmailApp.getUserLabelByName(labelName);
      if (!label) {
        Logger.log("Label not found.");
        return;
      }
      
      var threads = label.getThreads();
      
      // Check if there are any threads
      if (threads.length == 0) {
        Logger.log("No emails found with this label.");
        return;
      }
    
      // Loop through each thread
      for (var i = 0; i < threads.length; i++) {
        var thread = threads[i];
        var messages = thread.getMessages();
        var message = messages[messages.length - 1]; // Get the last message in the thread
        var subject = message.getSubject();
        var body = message.getPlainBody();
        var sender = message.getFrom();
        var date = message.getDate();
        
        // Create a calendar event
        var calendar = CalendarApp.getCalendarById(calendarId);
        calendar.createEvent(subject, date, new Date(date.getTime() + 60 * 60 * 1000), {description: body + "\n\nFrom: " + sender});
        
        // Remove the label from the processed thread
        thread.removeLabel(label);
      }
    }
    
    

     

  5. once it's in – add the label and calendarID – this is the only info that you need to update

    1. gmail label
    2. calendarID

    Strain out spam - create calendar events out of work emails automatically.

 

  1. Be sure to save it.

    Strain out spam - create calendar events out of work emails automatically.

 

  1. then you have to give it a "trigger"

Strain out spam - create calendar events out of work emails automatically.87

  1. click add trigger

    Strain out spam - create calendar events out of work emails automatically.

 

  1. Popups have to be allowed (it will give you a warining if they are not and a chance to allow them)

Strain out spam - create calendar events out of work emails automatically.

 

  1. Popup asks you to sigin (again) to validiate your account

    Strain out spam - create calendar events out of work emails automatically.

 

  1. Asks you to approve the script you created

    Strain out spam - create calendar events out of work emails automatically.

 

  1. just hit "allow"

Strain out spam - create calendar events out of work emails automatically.

 

 

  1. Once it saves / completes – Click main "Apps Script" to get back to projects page

    Strain out spam - create calendar events out of work emails automatically.

  1. Click into one you want to run / try
  2. Click "Run" and the script will run on your inbox – making events for any older emails you have:

 

Running the “Apps Script” on your current labels will move any events in them into your calendar. Then moving forward – the “trigger will automatically create new events when there is a new email in the “label”.

With this set up – you can see the final product.

End up with 1 calendar with all events auto added to it.

Strain out spam - create calendar events out of work emails automatically.

 

 

 

Scroll to Top