Send Google Mail to Evernote

Evernote is a great system to organize your notes, and to remember everything. You often want to add email message to Evernote, for example to add it to a To-do list. Evernote makes this possible by providing an email address, to which you can forward other messages–they will then be added to your other notes. But you still have to tag them, and you may want to put them in a different notebook. This can also be done by appending notebook and tags to the subject line, but this takes time and you can easily make a typing mistaken.

The method described here makes it much faster and easier: simply drag tags and notebook to the message, that’s it. It is shown in this video, and you can click through to read how to make it work for you. The video is short, less than 40 seconds, but it should not take more time to forward the message and see the result.

How does it work?

Each Evernote account comes with a unique email address (like ‘myname.12345@m.evernote.com’) which can be used to add content via email. You can forward a message to this address to add it as a note to Evernote.

Here, the messages are forwarded by a Google Apps script. This script will run at regular intervals, and read the Gmail labels Evernote and its sublabels. It will forward the last message of each thread that has one of these labels to the Evernote email address.

If a sublabel of the Evernote label was attached, it is appended to the subject line with an ‘@’ prefix. Similarly, other labels are appended to the subject line with a ‘#’ prefix. Evernote will read this subject line and place the note in the indicated notebook and attach the given tags.

In a Google Docs spreadsheet, a log is kept to record all forwarded email messages.

After forwarding, the Evernote label or sublabel is removed, so the messages will not be forwarded again.

Set up the script

To make this work, you start by creating the same labels/sublabels in GMail that you also use as tags in Evernote. You don’t have to create all tags, only the tags that you plan to use from Gmail. Also create a label ‘Evernote’, and create sublabels for all notebooks that you plan use.

Now configure the script and have it run regularly:

  1. Go to gm2en.com,  You may have to authenticate and grant access to the script to run.
  2. Check or fill in your Evernote mail address
  3. Select the Evernote label–any message with this label, or  a sublabel, will be forwarded to Evernote.
  4. Optionally, change the interval with which your mail is checked. Keep in mind that there are quotas for accessing email and use of computer time, so don’t set it too often. If you receive error messages, you may need to check less frequently, and increase the time interval.
  5. Press Submit

Web interface Gmail to Evernote

That’s it. Now, if you assign the Evernote label to any message, within 15 minutes  (depending on the time you set in step 4), the message is added to Evernote, and the label removed from the message. You may have to refresh Evernote to see the new note.

Advanced options

Click on Show advanced options, to view and change these options.

Adding a default tag

If you have several Google accounts, you may want to distinguish mail forwarded from each account. This can be accomplished using a default tag, e.g. home for your private account, and work for work account. This way, you can keep them separate in Evernote.

The log sheet

When an email message is forwarded to Evernote, the script will write a line in this spreadsheet, containing the date, source (including the email address) and message (the adapted subject line). This will be helpful to track errors. The first time, this sheet is created automatically and the ID filled in here.

If you have several Google accounts, you can use the same log sheet for all accounts:
  1. Share the log sheet of one account with all other accounts,
  2. Copy the Log sheet ID from this account to all other accounts.

Multiple sign-in, number of accounts

If you use multiple sign-in, the link in the note back to the email may not work; select the number of multiple sign-in accounts that you use, so it will give alternative links that will work. See this post for a more extensive explanation.

If you set this value to 0, the link to the message in Gmail will not be shown.

Header fields

Email header fields are added to Evernote. In the note, you can see who send the email, to whom, and when. Other fields are also possible, by changing this line. This is a comma-separated list of the fields that will be shown.

By default the value is ’From, To, Cc, Date’. Fields are only shown if they have content, so if there are no Cc-addresses, this header field will not be shown. Other fields that you can include are: Bcc, ReplyTo, and Subject.

If you don’t want any header fields, set the value to an empty string, ”.

Header CSS

You can configure the CSS style for the header DIV, containing the header fields and the link(s). By default, it is set to ‘border-bottom:1px solid #ccc;padding-bottom:1em;margin-bottom:1em;‘ showing a light-grey line between the header and the message. You can change this value here.

Tag label

By default, when no label is specified here, all labels except the notebook (sub)labels will be sent as tags to Evernote. If you specify a label here, only this label and its sublabels will be sent as tags

Sent label

If a label is specified here, it will be assigned after a message is sent to Evernote. It must be different than the notebook label, but may be a sublabel of it.

Manual configuration

You can also manually configure the script.

  1. Open the script at gm2en.com/script.
  2. Go to Resources – Current script’s triggers, and edit the trigger, or remove it to stop the script from forwarding messages to Evernote
  3. All other settings are stored as so-called User properties. To access the User properties, open the script at gm2en.com/scriptthen go to FileProject properties, and click on the User properties tab.
userproperties2

Notes

  • Labels in Gmail are assigned to threads, not to individual messages. This script will take the last message of a thread and forward only that message.
  • The Evernote label, or any of the notebook sublabels actually triggers the forwarding. After forwarding, these labels are removed from the thread, to avoid forwarding multiple times. If you assign multiple notebook labels, the message will be forwarded multilple times and placed in each notebook once.
  • If you want to add a remark to an email message before forwarding, you can forward the message to yourself, and add the text, before adding the labels.
  • It is safest to assign the tag labels first, and the notebook label last; Otherwise, it might happen that the script runs just after you added a notebook label, and does not copy the tag labels that you might insert later.
  • Using Gmail filters, you can automatically assign labels to incoming mail. In combination with this script, you can forward message from certain senders or with a given subject line directly to a selected notebook in Evernote, with the appropriate tags.

If you encounter any problems in getting the script to work, or have suggestions on how it can be used or improved, please add a comment!

 

This post is also available in: Dutch

138 thoughts on “Send Google Mail to Evernote

  1. Mike Y

    This looks amazing. Unfortunately I’m spending more time tweaking my GTD (Get Things Done) system than I am getting things done! There might be some irony there, or am I making the classic ‘Alanis Morissette’ language error? 😉

    Reply
  2. Peter

    Nice script.

    I ran into a small problem.
    I started out by organizing things according to “http://www.thesecretweapon.org/”
    But they use tag names like”@home” which messes with the automatic naming of mail when sent.
    Changed those in Evernote. Problem solved.

    Works great.
    Thanks

    Reply
    1. Harry Post author

      I also use tags like @home, that works fine. The subject line will look like “subject @myNotebook #@home”, and Evernote will correctly assign the tag @home and place the note in myNotebook

      Reply
  3. Travis Llewellyn

    Thank you for this script, I have been using the Mailbox app for the iphone and one thing it does is allows you to send emails to folder / tags. But it creates them under [Mailbox]/Evernote.
    I had to make a few changes to your script to make it work.
    I changed the following
    line 60 to this var labelPath = labels[i].getName().split(‘\]/’);
    line 61 to this if( labelPath[1] == cfg.nbk_label && labels[i].getName() != cfg.sent_label ) {
    line 78 var msgLabelPath = msgLabels[k].getName().split(‘\]/’);
    line 79 if( msgLabelPath[1] != cfg.nbk_label &&
    line 81 ( cfg.tag_label == ” || msgLabelPath[1] == cfg.tag_label ) ) {

    Basically I have made the split look for the ]/ and then made the script look for the second array field.

    Reply
    1. Harry Post author

      Thanks for this information, Travis.
      In the new version, the label that selects the messages for sending to Evernote, is called Evernote by default, but can be changed. However, it still has to be a top-level label.

      I was not aware that Mailbox does not allow using top-level labels, but creates all labels under [Mailbox]. If you would create the label in Gmail on the web, is it not usable in Mailbox?

      Reply
      1. Travis

        Harry,
        Mailbox.app does let you use labels but for it to be viewable in the app it has to be under the [Mailbox] label.

        Reply
  4. Tomas

    Hi. Thank you, this script is awesome.
    I have question. When i add to thread only tag label (with # prefix) and not notebook label (use default), in generated note is in end of subject line empty @ char. Is there any chance to remove it?
    Thank you. Tom.

    Reply
    1. Harry Post author

      I can provide some support, but need more information. In general, please use the comment option only to provide feedback or ask questions that are of interest to more people; otherwise, use the contact form.
      If you need support, please create a folder on your Google Drive, add screenshots showing your Gmail labels, Gmail to Evernote settings (from http://gm2en.com/, showing advanced options, and if relevant, a screenshot showing your Evernote notebooks and tags.
      Then share the folder and the log file with me: set sharing options so everyone with the link can view, and copy the link in the message of the contact form.

      Reply
  5. eroq

    Is there a tutorial on how to set up to automatically forward to desired notebook?

    I’m reading through what you have on this site and maybe I am just not savvy enough to understand.

    The reason I am here is I have looked at other options. Gmail filters don’t automate subject lines and therefore do not automatically file into correct notebook. IFTTT, Zapier and others deliver muddled plain text which I do not want.

    My goal is to have my inbox and sent emails automatically go into an archive notebook in Evernote just as a backup. I do not want to sort these once they are there. It is useful to see them in this format though and I hope I can figure out how to set this up correctly.

    Thank you,

    Eric

    Reply
    1. Harry Post author

      Hi Eric,

      Thanks for your feedback.
      The article describes the basic operation of the script, where you manually assign the labels.
      To automatically forward to a desired notebook, you would have to create a filter that assigns a label to all incoming mail. You could, for example, search for your own email address and use that as a filter. However, I would not know of any way to automatically label all outgoing messages.

      The script is not intended for automatic backup purposes, and even if you found a way to assign a label to all (incoming and outgoing) mail, it might leave out some messages because it only forwards the last message in a thread, every time the script runs–so make sure the script is run very often.

      For backing up your gmail, there are better ways, see http://lifehacker.com/5773362/back-up-your-gmail-the-easy-way-or-the-cheap-way

      Reply
  6. Yikes

    Hello,

    Perhaps my first comment became lost – not to worry…

    My question: Like so many others my gmail is being limited by google. Batches arrive at 254 gmail daily or so. Knowing this… is there a way to change Evernote so that it reads the actual age of the gmail and NOT the date the gmail actually is transported to EN? (I need the date of gmail for sorting and finding.)

    If not, is it possible to delete all the incoming gmail in EN until today’s date is reached and then EN’s date will have its date aligned with the date of brand new gmail. Since my business is so new, I can sacrifice day’s old gmail and older. Lastly my structure in gmail is one master label with multiple sub-labels attached. The same structure is applied to tags in EN.

    Thank you very much.

    Reply
  7. Pingback: Gmail to Evernote messages now in Sent mail | HarryOnline

  8. Andrew

    Is it possible to make starring an email in Gmail the trigger for uploading it to Evernote?

    Reply
    1. Harry Post author

      Theoretically yes, but then you don’t have the option to select a notebook–or you would have to both star it and apply a label.
      If you wish to use starring, you could copy and adapt the script.
      There are also IFTTT scripts for it, but then you lose formatting and attachments.

      Reply
      1. Andrew

        Thanks for the reply. So I went to script.google.com, went to my “User properties,” and changed the value of the “gm2en_nbk_label” to “starred.” I was hoping that this would send starred emails to evernote, but it doesn’t. I also tried changing “gm2en_nbk_label” to “label:starred” just in case, but that didn’t work either. Can you tell me what I’m doing wrong, and/or how I can accomplish this?

        Reply
        1. Harry Post author

          The script can not use starring as a label.
          If you wish to use starring, you have to copy and adapt the script.

          Reply
          1. Andrew

            I don’t know anything about coding, so I wasn’t able to get anywhere copying and adapting your script Harry- it’s too complicated for me. I did, however, find a ready-made (and very simple) Google Apps Script online for forwarding starred emails, and was able to make that script work for me. I wanted to reply back with the link for others who are looking for something similar.

            http://apple.stackexchange.com/questions/88221/automatically-forward-starred-in-gmail-messages-to-omnifocus

  9. Lance

    Hi Harry, great script.

    How do I disable the script though. I saw it once but I cant it anymore

    Reply

Leave a Reply

Your email address will not be published.