Joplin Export: Export emails from Thunderbird to Joplin

:star_struck: Fantastic!

Testing

  • Setup: Win10; TB 91.10 (x64 portable); Jopin 2.8.8 (portable)

  • Smooth install of add-on, paste token & save (connected), set parent folder & save, otherwise left default settings in place. Used an email with simple formatting and a single TXT file attachment. The note generated correctly and quickly in Joplin, with formatting and attachment as expected.

  • Tested same email with "Add header info" enabled. PASS

  • Tested as TODO with header info off, multiple tags separated by "comma", and with "Include Tags from Email" enabled - MINOR FAIL

  • Tested with different expression in "Trim subject" - FAIL

Comments

  • Documentation

    • Pretty good, well done.
  • Add Header Info (Note Header Setting)

    • Presume we are not stuck with your default layout.
    • You mention defining a template in the "Note header" setting.
    • Where is this found?
  • Tags

    • When edited directly in configuration works fine, eg. "email,tb". However...
  • Include Tags from Email

    • Very nice inclusion, well done. Unfortunately, i experienced a minor issue.
    • When using a low order tag, that came default with Thunderbird, it becomes $label1 in Joplin.
    • If i tap number "1" to tag an email as say "Important", the tag exports to my note as $label1.
    • When i tap the number "2" to tag as say "Waiting", the export tags as $label2.
    • If however i create my own tag, eg. a 7th one as "Rotation", then tap the number "7" to tag my email, it exports into Joplin correctly tagged as Rotation.
  • Trim Subject

    • Does this apply strictly to the value of "subject"?
    • I tried a custom regex across the whole string and it made no difference.
    • Whether the expression was "broken" or "valid", the title of my note in Joplin did not change.
    • I'm wondering, am i allowed to put say {{subject}} in the "Trim Subject" field?
    • Could i put say {{author}} ({{date}}), and end up with a note titled "Marph (7/7/2022)"?
    • Getting too complicated?
    • Perhaps a new "Note Title" setting that allows me to do such a thing?
    • After extracting my custom note title, then you would apply whatever regex i might have supplied.
    • If that were the case, perhaps the setting would be better titled "Trim Note Title".
    • Jolly software development. One little biddy tweak and BAMB! - thirty consequences!!!

Thank you very very much for your superb effort @Marph.


As an side... i couldn't <right-click> to paste my web clipper token into your add-on. I was about to report it to you, but fortunately tried the settings window of a different Thunderbird add-on. None of the settings windows for my add-ons respond to <right-click> to bring up the context sensitive menu. Go figure. Probably been like that for years!

2 Likes

Thanks for the detailed report @Zargron!

I think you did the tests with the add-on version 0.0.1 and not the release candidate for 0.0.2 (needs to be unzipped and installed manually). This might have caused some confusion.

The setting "Add Header Info" was removed. The new setting "Note header" is right at the settings page for the release candidate. The settings page should look like:

I will try to reproduce it. Might be a bug.

Yes, this applies only to the subject.

A working regex is ^(((Re|Fw|Fwd):|(\[.*\])) ?)* for example. Maybe you can try to adapt yours based on it. If there are further problems, you can post it and we try to get it to work. Regexes are always tricky.

No, "Trim Subject" purely regex. I think this and the following questions are caused by using the add-on version 0.0.1. They should resolved by the new settings "Note title" and "Note header" in the release candidate.

I'm always using Ctrl+V, so I didn't know :smiley: I will check if there is an option to add a context menu.

You are welcome :slight_smile: If I forgot to answer something, feel free to reference it again.

1 Like

Thanks for your excellent response @Marph. I used the release candidate you suggested.

  • Setup

    • Win10; TB 91.10 (x64 portable); Jopin 2.8.8 (portable)
    • Thunderbird Addon (dated 7/7/2022 still showing ver 0.0.1)
  • Testing

    • Installed release candidate over existing, replaced okay.
    • Used several different emails varying attachments/content and so forth.
    • Overall working well.
  • Note Title / Note Header

    • Both working
    • For "Header" i created markdown table with author, date, subject & tags
    • Tested on an email without subject, comes through neatly with a note title of "(No subject header)"
  • Suggestions for Note Title/Header

    • Documentation
      • perhaps remind users that header object reference is case sensitive
      • should be all lower case
    • {{date}}
      • any chance of getting this in short format?
      • for example, mine comes through as Thu Jul 07 2022 13:32:51 GMT+0930 (Australian Central Standard Time)
      • would be nice to have date formatted as for example: 7/7/2022
    • {{author}}
      • would love to be able to strip away email address
      • currently coming through as "Frank Harrodford <frankharrodford@example.com>"
      • when using your default, (eg. {{subject}} from {{author}}), it would be nice simply have "Joplin Rocks! from Frank Harrodford", without being suffixed with the email address.
  • Question - Inline Images

    • URL links to online images obviously coming through correctly.
    • How much work to bring inline images through as an attachment?
    • Currently there is no indication that an image has been left behind.
  • As an aside - drag & drop "inline image" from Thunderbird to Joplin

    • Without inline images being exported to Joplin, no big deal, i'll do it manually.
    • When i tried to drag & drop from TB to Joplin, an interesting thing happened.
    • When i dragged a PNG image from TB into Joplin, it converted it to BMP!
    • When i dragged from TB to windows explorer it saved as PNG.
    • When i dragged that image from explorer to Joplin, it correctly came through as PNG.
    • Ideas anyone?
  • Include Tags from Email

    • Working of course but with $label1 issue as previously described
  • Trim Subject

    • Working of course, (previous testing i was doing something silly)
  • Unable to <right-click> in add-on options

    • I suggest this is NOT a fault in your add-on and to not spend any time looking into it.
1 Like

Thanks again for taking the time to test the add-on :slight_smile:

I think I added a reference to the Thunderbird documentation. The variables are all lower case there. But maybe this is too technical already. I will read through it again.

Suggestions to {{date}} and {{author}}: Both seem to be useful and not too difficult to implement. I think it would be good to group them together with the "Trim subject" setting. For now, the strings are directly taken from the Thunderbird API without any modification.

It's possible for sure, but I think there can be a few difficulties:

  • There have to be two functions for parsing the image links: One for markdown mails and one for HTML mails.
  • Error handling when there is no internet connection.
  • Should the original inline image be replaced by the Joplin attachment? If yes, this would add some complexity, too.

This is an interesting topic, but will require some time. So I guess it won't happen soon.

I fear that the drag&drop behaves differently, depending on image format, target application and OS. It might be worth to search a bit through the forum or even open a new thread at the end. Maybe someone uses drag&drop regularly and can answer what works best and how it works.

As a side note: I think the recently discussed features/fixes won't be in the next release, because it needs to happen soon to stay compatible with Thunderbird 102. However, I'm happy to work on them and give a notice when there is something to show.

1 Like

My pleasure.

Manual transfer images - Thunderbird > Joplin

I mentioned in one of my posts that "drag & drop of inline image from Thunderbird on my Win10 computer into Joplin converted to BMP". Well, i tried "copy & paste" and that deposited image in existing format, without conversion, eg. PNG remained as PNG. So something odd going on with drag & drop. Another piece of whimsical behaviour from Windows that is not worth pursuing and adds yet another stich in the long line of reasons to switch to any other operating system.

Work to bring inline attachments into Joplin as attachment

Yes, i'd imagine this would be a lot of extra work, and concur that you should leave it on the back burner and simply chip away at it.

Strip away email address or display name, eg. Trim Author

Having already included regex processing in your code, being able to also parse {{author}} would hopefully not be too much work, and surely handle my specific request by using "<>" as boundaries.

Convert or rather format {{date}} to something shorter

I wonder about grouping with the "trim" fields a Date Format field? Presumably you have clean access to the numerical {{date}} value. I wonder how hard it would be for you to offer to apply a "format" string. Much like the "format()" function in Node.js or other languages.

features/fixes won't be in the next release

No worries. Hopefully you don't have to do too much ongoing work on this fairly soon. The area you are interacting with in Thunderbird is very mature. And the Joplin interface appears pretty stable. So hopefully we get to enjoy it for several years without burdening you with too much effort.

2 Likes

Currently the date is only a string, but it shouldn't be hard to parse and reformat it. I didn't look for it yet, but I think there should be a good JS library for converting dates.

Version 0.0.2 of the add-on is now available at Thunderbird's add-on store. It contains the changes mentioned in

and is compatible with Thunderbird 102.

1 Like

Thanks Marph.

Please note that upgrade of your add-on to 0.0.2 happened automatically without issue in my copy of Thunderbird.

  • Export State

    • Working as expected, i tested "Always vs On Failure"
  • Clear target notebook

    • With no destination notebook configured, correctly presented with popup error message:
      Joplin export failed
      Please check the developer console.

    • Error console of course had "Invalid destination notebook" error message.

    • Would it be much trouble to have a custom error message to alert user of notebook issue, with a brief explanation on how to fix? That could be nice for the average user who might not have heard of a "developer console", let alone where to find it.

  • Customize Note Title

    • Working as expected.
  • Thunderbird Version 102 (all variants)

    • I notice you changed "strict_max_version" to (102.*)
    • Should you close issue #10 ?
  • Other Suggestions

    • Thank you very much Marph for registering some of my earlier comments as issues in Github.

Happy note taking everyone...

2 Likes

Thanks for the feedback again. It's very valuable!

I agree. It would be good to have a precise error message in the notification already. It would require some better exception handling. I will add it to the to-do list.

Done :+1:

Version 0.0.3 was just released in the add-on store. :tada:

Changes:

2 Likes

Thank you for creating this add-on; Your installation instructions are excellent and the add-on works like a charm.

I'm not a power TBird user (yet), so is there a way to right-click on the email to be processed by your add-on and select "Joplin Export" from the resulting context menu? This would be far more user friendly for me than the way I' doing it now, which is selecting the desired email and moving the mouse to the "Mail Toolbar" and clicking the "Joplin Export" button.

1 Like

Thanks for trying the add-on!

Thunderbird's API seems to allow adding items to the context menu, so I will try it. In the meantime, you could use the hotkey Ctrl + Alt + J for exporting. Maybe that's a bit more convenient.

I was not aware of Ctrl+Alt+J and just tried it; a much more convenient method.

One more suggestion; Is there any way to provide feedback after invoking the add-on? I'm not quite sure if to process worked or not, so I alt+tab to Joplin to double check each time. I've been burned in the past when an app hangs or fails without feedback and my requested action was not successful.

Thx again for taking the time to create this, it's a real time saver and also for being so responsive.

1 Like

The notification behavior can be changed in the add-on settings (Tools -> Add-ons -> Joplin-Export -> Show notifications). If you switch it to Always, there should be a notification after each export (at the bottom right corner). By default there is only a notification if something didn't work.

Also note that you can change the hotkey. Imo. the setting is really hidden. It's at addon settings -> click the gear at top right -> Manage Extension shortcuts.

1 Like

Wow, talk about the add-on I didn't know I needed.

The main stopper to getting this working was first realizing it uses the Joplin Clipper and then setting it up, as I hadn't been using it yet. Quite a number of hoops to jump through for that to work.

Anyway, this works like a charm. The only nit I can see now is it would be nice if there was a context menu entry for it.

Big thanks for your obvious hard work on this add-on!

1 Like

Thanks, I didn't notice this in the settings. Again, you have this well thought through.

This is an indispensable tool and thank you again for creating and being super accessible.

1 Like

Version 0.0.4 is now available at the Thunderbird store :slight_smile:

Change: Add export by context menu

3 Likes

Hi @Marph,
After TB updated to v115 supernova this useful add-on was no longer compatible. Do you have any plan to update it?

Sure, I will check Thunderbird's release notes and if there are no breaking changes, a new compatible version will be released soon.

Edit: Version 0.0.5 with support for Thunderbird 115 should be available at the add-on store now.

3 Likes

Hi @Marph
This is working as usual, thanks a lot.

1 Like