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


(Jake Bernstein) #1

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?


(Mark Anderson) #2

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.


(Paul Walters) #3

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.


(Jake Bernstein) #4

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.


(Jake Bernstein) #5

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…


(Paul Walters) #6

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?


(Jake Bernstein) #7

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.


(Paul Walters) #8

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


(Galen Menzel) #9

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]*)")) { 
$Name=$1;
$StartDate=$2;
$EmailProcessed=true;
}

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.


(Jake Bernstein) #10

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