Git Product home page Git Product logo

obsidian-google-mail's Introduction

Obsidian Google Mail

This plugin saves emails on Gmail as markdown notes. Use this plugin safely so you won't mess up your gmail account.

Application Scenarios

  1. Automatically save subsribed newsletter and takes note on it.
  2. You can email ideas to yourself and let the plugin collect them into vault.
2022-11-04.00.03.59.mov

Installation - I

Already have a credential : If you're using google api in other plugins you can simplely enable the Gmail api for that project, then you can reuse the credential.

Use my credential : I have a credential for 100 users and would like to know how much it's gonna cost for multiple users. Contact me so you don't need to go through this part. (thingnotok at gmail.com)

Create your own credential, it's free : Goto https://console.cloud.google.com/ to create the credential.

  • The detail steps with video can be found here

Installation - II

  1. Install this plugin manually or through BRAT

  2. Enable the plugin, and click option (or open the seting panel of this plugin)

  3. Click Setup button and Paste content from credential.json (from installation I)

  4. A web window should show up and ask you to login google with email access permission.

  5. The plugin will automatically query available labels in your Gmail account. Select the from/to labels to fetch.

    • From: Label to fetch from Gmail.
    • To: Fetched mail will be added with this label
  6. Assign a Folder to store all the collected email notes. (Default is "fetchedMail")

    • The plugin will create a folder if not exists.
    • A newsletter folder to use with DB Folder would be useful to organize your mail notes.
  7. Click the ribbon button on left side to fetch all the emails with that label.

Setup in Gmail

Labels: This plugin use label to decide which mail to fetch. So you need to use Gmail to assign the {From} label to those mails you want to fetch. The {From} label will be removed from the fetched mails, and {To} label will be added. These two labels should be mutually exclusive. I suggest to create a new label for {To}.

Filters:

  • You can add {From} label to mails manually when you review you inbox.
  • Or You can also setup filters to add the labels automatically.
    • Check the tutorial here.
    • Add the newletters so you can take notes on them
    • Add the mails you send to yourself, so you can achieve "email to obsidian".

Template

Check Template to learn how to setup a note template for email notes.

Security Issue

Background: Currently, the plugin will keep a .token.json file containing all the information required to access gmail account, so you don't have login everytime. But it also means that anyone with the file can do whatever he/she wants to your emails. In addition to the others, all plugins you use have access to this file, too.

This is actually a common issue for plugins trying to integrate other services. There are discussions about how to safely keep these security files. But it's not gonna easy for a pure local application.

What to do? For now, please don't use this plugin in public computers or shared vaults. Make sure no one can access the token file.

Another approach is that if you use this plugin for "newsletters" and "send to obsidian", then you can create a separate gmail account for them so those important business letters won't be afftected.

Other details

  • The mails are converted to markdown format. Some emails may seem weird.
    • Thanks to the contrubuters of Turndown.
    • I will add support to save email in plaintext format. Plaintext is suited for note-taking and avoid most of weidly large images in the note.

Thanks

  • The plugin originates from u/egauthier64's email-to-obsidian idea but is an approach based on Gmail server.
  • Thanks to YukiGasai for his great work on Google series plugins for obsidian. Please check his awesome plugins here, they are extremely useful with google suite and obsidian:
  • Thanks to @thingnotok for their great work on this plugin and maintenance.

obsidian-google-mail's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

obsidian-google-mail's Issues

Feature.....fetch on polled basis

I have already finished this, just need some more testing and will initiate a pull request.

  • Added a setting for Fetch Interval
  • Created a timer to poll/fetch on that interval.

Link attachment from the note template

Hello,

Thanks for this plugin, I just installed it and it works great !

I have a question about the attachments, is there a possibility to link them in the template in order to find the attachment of the email directly from the note?

Feature Request: Allow for Turndown to be optional in Settings

Use Case

Writing email in Markdown causes a problem as Turndown does not convert well.

Proposal

Make the Turndown call a Settings option so Emails could be written in pure markdown and then just incorporated into Obsidan.

Example

Here is the rendering in Obsidian of a simple markdown file sent as email.
Screenshot 2023-01-31 at 7 27 18 AM

This is the original email source. If pure markdown is used in the email, Turndown doesn't seem to recognize it.

Screenshot 2023-01-31 at 7 29 56 AM

Feature Request: Customize File Name

Love it. Seems to be working fine in my vault. Complicated emails with lots of images aren't always handled perfectly, but that's not unexpected. The one thing I haven't found how to do is to change how the file is named. Currently it is using ${Subject} as the name, and I'd like it to use ${Date} - ${Subject} instead. Is there a way for me to do that?

Content is not well fetched

The plugin fetches emails, it works.

But tags or body are not correct.

Here is what I put in my template:

${Body|raw} 

${Body} 

${Body|htmlmd} 

${Body|text} 

${Labels}

${Labels|tag}

${Labels|link}

And here is the result:

${Body|raw} 

 

${Body|htmlmd} 


${Body|text} 

[[obsidian]], [[INBOX]]

${Labels|tag}

${Labels|link}

What did I miss?

Feature: Download attachments

What I did

I sent an email with a PDF attachment.

What did I expect

  • The attachment file to placed in the vault "somewhere"....perhaps based on the vault settings for Attachment locations. That would be better than another separate attachment settings specific to the google-mail plugin.
  • A link placed in the newly created Note to the Attachment.

What happened

  • Attachmed PDF file did not seem to be transferred. I searched the vault, and also did a find on the vault hierarchy, and the file was not found.

Workaround

  • No known workaround

The release is not complete and cannot be download

I installed this maybe a month or two ago, and tested it successfully. I noticed recently I'm getting the following error when starting up Obsidian:

BRAT: thingnotok/obsidian-google-mail/
The release is not complete and cannot be download. main.js is missing from the Release

Can't get past "Setup Google OAuth" screen in 1.4.2

I have followed all the instructions, after I click the prompts in the OAuth screen I get a notification that I've been authenticated, and Obsidian displays a notification that I've been "logined" (should be *logged in). But nothing happens after that. This is on version 1.4.2. I haven't tested it on the latest stable version.

Prepended text to forwarded email not included.

What I Did

Forward an email, and put some text at the front of it.

What I expect

Text of entire email, my content and the forwarded portion should be included in the resulting note.

Actual Results

The pre-pended text is not visible anywhere. I have tested this with and without a template.

Here is the screenshot of the email:
Screenshot 2022-11-07 at 9 20 35 PM

and here is the resulting screenshot in Obsidian after fetching the mail (No Google-Mail Templates used).

Screenshot 2022-11-07 at 9 24 09 PM

Save Labels on Logout

Sometimes I have to logout and log back in due to a token error.

When I log out, the Labels I have set are not saved, and rather than just logging back in. Other settings are saved (e.g. Mail Folder).

[Design] Load credential with file or let user paste content directly?

(using file)

  • Benefits
    • much more simpler compared to paste three fields from credential
  • Drawback
    • Need to access file outside vault
      • additional access permission
      • need fs module

Maybe let users directly paste json content is a better idea? open file and copy content is much easier than key in the path of file.

[Feature] Support templater/template for new email notes

Use a template frame works for all notes should be useful to organize the emails.
Email fields can be in ${Email:Field} format

Possible format for the mail:

title:: ${Email:Subject} %% This line will be the filename.
tag::  ${Email:Labels|link} #captured. %% link or tag
from:: ${Email:From}
date:: ${Email:Date}

---

${Email:Body|format} %% plaintext or HTML2MD

Can't fetch mail in 1.4.3

After some trial and error, everything worked fine through setup. I have some labels applied, I have a template and my folders set up. I can do the plugin setup in Obsidian and it recognizes the labels. But when I go to actually fetch the mail, nothing is retrieved. No idea what my error might be.
Error log in the developer console attached.

image

Feature: Parse tags and destination folder from Title/Body

This is awesome!! Thank you!

At the risk of being greedy, there are a couple other features that would be really cool as this matures. I know these are mostly outside the scope (e.g. require file munging and parsing) but could be some cool features.

  • Post processing hook. Even if this was just a script. So for example, you could allow users to pipe PDF attachments through an OCR engine / indexer
  • Delete on fetch (this is destructive, I know, but I am using a dummy Gmail account which I will most likely never log into interactively)
  • Allow for user defined labels, not just the fixed set
  • Auto-filing in the vault. for example, maybe specify a Vault folder in the subject line like Evernote does with @Notebook
  • Auto tagging using tags in the subject line

Feature/Fix: Date-Time from ${X-Received}

I'm unable to get ${X-Received} to render. I was trying to use it to get the date and time from so I could use that to rename the file (I want to start the filename with 'yyyymmdd_hhMMss'). If you're diving into the code anyway, would it be possible to make available a ${DateTime} variable that provides the date/time in a common format (something predictable like 'YYYY-MM-DDTHH:mm:ssZ' or an option for multiple common formats)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.