New version of Gmail to Evernote script creates link to Gmail in Evernote

Version 2 of the Gmail to Evernote script has been released. The new version adds text on top of the message in Evernote, with the basic headers from the email message (From, To, Date) and a link back to view the message in Gmail. For example, if you forwarded the message to a task list in Evernote, you can now quickly send a response after completing the task. No more searching in Gmail to find the message back!

There are more changes, and you have to do some extra configuration steps if you use multiple sign-in for Google, because in that case, the link to the Gmail message is not always correct.

This version will send email notifications when a new version is available. If you are running the script directly from bit.ly/gmailevernote, you don’t need to update, and you will not receive a notification, unless some other action is required or relevant information can be given.

If you made your own copy of the script, you will always receive a notification of new versions, so you can replace your copy with the new version.

You may have to authorize and grant access again, see the previous update on Gmail to Evernote.

Configuration

For basic configuration, see the original post on Gmail to Evernote.

Multiple sign-in

If you use multiple sign-in for Google, there is no single URL for an email message. For a message with ID 12345abcd, there are two possible URLs:

  1. The regular one, copied from the address bar in Gmail:
    https://mail.google.com/mail/u/0/?shva=1#inbox/12345abcd
  2. From the RSS feed (https://mail.google.com/mail/feed/atom), it looks like:
    http://mail.google.com/mail?account_id=example@gmail.com&message_id=123456abcd&view=conv&extsrc=atom

The first method only works with the first account that you used to sign in (default account). If you signed in with more accounts, the link will be https://mail.google.com/mail/u/1/?shva=1#inbox/12345abcd for the second account, etc. So the link to an email message may be different if you signed out and sign in again in a different order, or work in a different browser.

The second method looks more promising, as it uniquely identifies both the account and the email message. However, it turned out that this only works if the account is the same as the default account. Technically, I don’t understand why this does not work, it should not be too difficult for Gmail to check whether the account is one of the signed-in accounts and use this account, so I assume this is a bug, or an oversight from the folks at Google.

Thanks to Mo’in Creemers for pointing me to the second URL format. Now it is up to Google to make this work!

Work-around

The Gmail to Evernote scripts adds a link in the first format to Evernote. As mentioned, this only works for the default account. If you use multiple sign-in, you can configure the script to also present alternative links, like:

https://mail.google.com/mail/u/0/?shva=1#inbox/12345abcd - user 1 - user 2 (example@gmail.com)

You can change the number of users in the User properties (under File – Project properties), set the value for gm2en_nacct to the number of accounts.

Header fields

In the new version, email header fields are also added to Evernote. In the note, you can now see who send the email, to whom, and when. Other fields are also possible, by changing the value for the gm2en_fields user property. 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, ”. If you also set the value for gm2en_nacct to 0, the link to the message in Gmail will not be shown either.

Style

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 by editing the user property gm2en_hdrcss.

More changes

The names of the user properties, that are specific for this script, have been changed and now have a prefix gm2en_, to avoid any confusion with other scripts.

This post is also available in: Dutch

25 thoughts on “New version of Gmail to Evernote script creates link to Gmail in Evernote

  1. Pingback: Send Google Mail to Evernote - HarryOnline

  2. Joe

    I was struggling trying to modify your original script to do this very thing (add header info) and stumbled on your update while Googling for some code. Excellent update, thanks so much for this awesome tool!

    Reply
  3. Lars

    Hello Harry,

    nice update. Thank you for integrating the link to the gmail. It works like a charm.

    One new suggestion: create a user property for the tag “Evernote”

    Cheers,
    Lars.

    Reply
  4. Matt

    Works beautifully. Love the link feature. It’s been the only thing keeping me from using TSW as my task/project management. I’m having some issues with the tag management however.

    I set a default tag in my personal gmail and my work Google Apps account to be “Personal” and “Work” respectively. However, when they come down into Evernote the title of the note has “#Personal” or “#Work” at the end of the title but no tag assigned. Additionally, if I have other labels that are not sub to the Evernote label (just a “normal” gmail label) applied, such as “Wife” for all emails from my wife, it tries to apply that as a tag. I’ve had a couple successfully tag that way and a couple just do the same with adding another “#tag” to the end of the title.

    Reply
    1. Harry Post author

      Forwarding the messages with a # in front of each label, as in ‘#Work’, appended to the subject line is exactly what the script does. Evernote is supposed to strip these from the subject line and add them as tags. If not, make sure the tags exist already in Evernote.
      The script only forwards messages, it has no access to Evernote, so it does not know which tags to apply and which not.
      In the next update, I will add some flexibility, so you can specify the name of the Evernote label, and optionally also a top label for labels that should be assigned as tags.

      Reply
  5. Lena Rotenberg

    Harry, you have saved my sanity. I was able to configure your script to work perfectly, having never heard of Google Scripts before stumbling upon yours tonight, via a desperate search for “Gmail into Evernote.”

    If Gmail again gives me a “Unusual Usage – Account Temporarily Locked Down” message, I can simply shrug. My actionable stuff, except for the last 15 minutes’, will be accessible outside gmail. YES!

    Thank you so much! Dank je wel! Muito obrigada!

    🙂
    Lena

    Reply
    1. Harry Post author

      Nice to hear!
      Just wondering, what does it take to get your account temporarily locked down? Never had that experience…

      Reply
  6. Steve

    Hi Harry,

    Thank you so much for this script–it’s exactly what I needed!

    One suggestion–could there be an option to put a “Sent to Evernote” label on the message after it’s been sent to Evernote? I know I can look in the log spreadsheet to see a list of messages that have been forwarded, but it would be great to have a label inside of Gmail that I can use to see at-a-glance which messages I’ve sent to Evernote.

    Thanks again!

    Reply
    1. Harry Post author

      I will keep that as a suggestion for the next version. Current suggestions are:

      • Assign labels as tags only if they are sublabel of a certain other label (like notebooks must be under ‘Evernote’)
      • Be able to use a user-define label (not just ‘Evernote’) as parent for notebook labels
      • Assign new label to forwarded messages

      Considerations for implementation are that it should be backward-compatible, i.e. existing users must be able to continue using it as before, and the balance between how easy it is to implement and how much use would be made of it.

      Reply
  7. Onji

    Hi Harry,
    Thank you so much for this post! I work for a realtor and this is going to simplify her life!

    I have followed every step of the set-up, but the emails are not being forwarded to Evernote. I double checked that I have the right email, tags, etc..but they still don’t show up in Evernote. ):

    Any help would be appreciated.
    Thank you!
    O (:

    Reply
    1. Harry Post author

      Hi Onji,

      It’s hard to say with the information available. The most common issue is that the Evernote label is not with an initial capital. It really should be ‘Evernote’, not ‘evernote’, or ‘EverNote’. Then try to add just that label; you can run the script manually as well as using a trigger. If, after running the script, the label has gone from the email thread, but, after synchronizing Evernote, you don’t see it, double-check the Evernote forwarding address in the User properties.
      If it still does not work, please repeat the whole setup. describing what you type and what response you get, if applicable. Send me the details using the contact form on this site.

      Reply
  8. Charley Harper

    Hello Harry,
    Having the Gmail label, which triggers the forwarding to Evernote, to be configurable would be a great help. I’d like to use something like “->Evernote” so that it appears at the top of my Gmail Labels tree. I’d rather not edit the script and have to hardcode this.

    Thanks for listening, and thanks for sharing your work!

    Reply
    1. Harry Post author

      Hello Charley,

      Yes, I am working on a new version, which, among others, has the top label for the Notebooks configurable, and also makes it possible to configure a top label for labels that would become Evernote tags–any labels outside these two top labels are ignored. And an easy way to set up the script and configure these labels. If you subscribe (top of the sidebar), you will be informed when it is ready.

      Reply
      1. Charley Harper

        Thanks for your prompt reply, Harry. Your proposed changes sound very useful.

        One concern I now have: In the wake of of Google’s decision to axe Reader (negatively impacting millions of people who relied on it), what confidence can I have that Google will not arbitrarily choose to axe or deprecate any other of its services? Today, Google Reader, tomorrow perhaps Apps Script…

        It makes me reluctant to rely on any Google service, if I can find another equivalent option. That’s sad.

        Reply
    1. Harry Post author

      For the script is it no problem, it will just add a @ or # in front of the label, and add it to the subject line. I have a number of Evernote tags starting with @, if I use those, the script add #@tag to the subject, and Evernote interprets this correctly and add the right tag to the note. I have not tried the other variations, but for the script, it should be no problem. Let me know if you find any problem in trying it out.

      Reply
  9. Steve Kellam

    Hi Harry,

    Since you are working on a new version, I wanted to ask if this would be a possible addition. Basically, I would like to be able to predefine certain gmail label that would generate a custom subject line on the email forwarded to Evernote.

    I have certain e-mails that I receive that are always attached to a GTD task in evernote. I would like to set up a Gmail filter that would use rules to look at incoming e-mail and attach a label that gm2en would recognize. When it sees this label, it would change the subject on the outgoing email to Evernote.
    It would be great you could pre-define like 10 different user defined texts that could be put in the subject line. I use ZenDone and it parses the title in Evernote to add GTD tasks. So if this feature was available, I could automatically create tasks based on email triggers.

    Say like UserText1 – “Pick up the milk”, UserText2 – “Complete this survey.”

    Then when I match a gmail filter and apply the label UserText1, the script would substitute that text in the subject line.

    I’m not how hard this would be to code but it would be very useful to me and hopefully others.
    Thanks for all you’ve done with this.

    Reply
    1. Harry Post author

      Hi Steve,

      Thanks for sending this suggestion. I don’t know Zendone , at first sight, it looks interesting. But even without Zendone, it makes sense to be able to edit the subject before sending an action, so it clearly describes the actual action to be taken, which is not always clear for the subject of the message.

      However, there is a tension between adding more features, and keeping the interface simple; for this one, I don’t have a clear idea how it can be implemented without complicating the set-up process.
      Sometimes, I get a bright idea how it can be done, so I keep it in my mind for a future update; but it will not be for the next update, which is almost ready.

      Reply

Leave a Reply

Your email address will not be published.