Tinderbox Forum

TBX 7.5.X - Importing emails from Mail.app via drag 'n drop

This is embarrassing to even have to ask about, but I’m probably missing something obvious. I want to drag 'n drop HTML email from Mail.app into TBX, but when I do, I get the source HTML that won’t render either in Preview correctly. Or if it does render, it renders with the complete header information and without importing any metadata, which is less than optimal.

Has anyone solved this issue or have another suggestion or best practice for getting email into TBX as a note?

There’s the nested assumption - what is ‘email’? I think what you’re asking for is the $Text of the note to show the email body copy rendered in RTF styled txt, based on the HTML-styled version of the email. does this include headers, or just some like the to/from? Or do these get ignored, or passed to (which?) attributes. So I guess the starting point is to understand what parts of the email you expect to see in $Text, defined in terms of the email’s structure and not how it looks in [some other app]. That’s not to be curmudgeonly, it’s just there is a lot of ambiguity. Different app’s derive their nice screen-styled text in different ways making for extra work behind the scenes. Plus emails vary quite a bit in format - which bits of an overall format/standard that they use.

Hmmmm. I just tried dragging (individually) a few messages from Apple Mail into the Outline view of a Tinderbox document. After a pause, the content of each message showed up as plain text. These were each HTML messages, so it seems Tinderbox – or something in the import chain – is stripping the HTML and styling and reducing the import to plain text.

Which is not the result @Jake_Bernstein reports, so I don’t know why it would be different here than there.

Edit: If I click into the message in Mail, use Select All, and Copy, then paste that into the Text of a note, all the rich text is pasted correctly.

The ideal for me would be if TBX by default upon DnDing an email from Mail.app did the following:

  • Imported the header information, with To, From, Received, Sent, and Subject being KeyAttributes.
  • Imported the HTML body text as rich text to $Text (if the email is plain text, then obviously $Text is just plain text too)

I don’t want the full header information, which is what I’m getting now and what is causing such bad importing.

1 Like

That result would be 100% acceptable to me, but for some reason, I’m not getting it. I wonder if there’s a prototype issue going on…

Prototypes don’t usually change the appearance of Text, but I suppose that’s possible. Maybe it’s the mail messages themselves? Do you happen to have a different mail client (like Airmail) you could test this with? Or messages from a different account?

OMG, I’m a doofus. I was dragging the email from Mail.app into Yoink and then dropping into TBX. I completely skipped that step in my brain when posting about the issue. A direct drag and drop from Mail.app works fine. LOL.

We should all be so lucky to find quick solutions. :crazy_face:

1 Like

This is one of my favorite nerdy ways to pretty up a tinderbox document. Here’s what I do:

Create a new boolean attribute named $EmailProcessed.

Then create an Email prototype with the following $Edict:

if(!$EmailProcessed & $Text.contains("Subject:\s*([^\n]*).*Date:\s*([^\n]*)")) { 

Make the $Color of the Email prototype white to mirror my email client.

Now create a new note, set its prototype to Email and copy and paste the email’s headers and body into the note text. The result:

A perfect email simulacrum that you can highlight, annotate, etc.

Note that the $Name of the note has been automatically set to the subject of the email, and $StartDate has been set to the Date of the mail. You could set things like From and To using the same regular expression approach above, but I don’t bother.

One limitation to this is that you have to paste in the URL to the message by hand.

I would LOVE it if this is how native mail import worked.

Here’s the sample document (485.1 KB) containing the Email prototype, which is pictured in the above screenshot.

1 Like

That’s very impressive and good stuff! Thanks for sharing!