Mail Rule Import Problem.

Hello,

I’m working on trying to alter the mail rule import script provided in the extras/scripts/mail folder.

I’d like to edit it so that the imported emails appear in the group eMails.

From reading the dictionary of devonthink pro, I thought I could simply add “in eMail” to the line,

tell application “DEVONthink Pro” to create record with {name:theSubject, type:txt, creation date:theDateSent, modification date:theDateReceived, URL:theSender, plain text:(theHeaders as string) & return & (theContent as string)}

such that it reads

tell application “DEVONthink Pro” to create record with {name:theSubject, type:txt, creation date:theDateSent, modification date:theDateReceived, URL:theSender, plain text:(theHeaders as string) & return & (theContent as string)} in eMail

This however does not work. Any ideas on how I can acomplish this?

Just use this snippet:


tell application "DEVONthink Pro"
	set theGroup to create location "/eMail"
	create record with {name:theSubject, type:txt, creation date:theDateSent, modification date:theDateReceived, URL:theSender, plain text:(theHeaders as string) & return & (theContent as string)} in theGroup
end tell

is there a way to have DTP / Mail.app send the mail into the group eMail and subgroup based on sender?

i’m not sure how to concatonate theSender on to “/eMail”

That’s of course possible, just replace…


set theGroup to create location "/eMail"

…with…


set theLocation to "/eMail/" & theSender
set theGroup to create location theLocation

What about saving attachments?

The script doesn’t support MIME parts like HTML or attachments.

Is it at all possible to import HTML mail messages into Devonthink? Specifically, I’d like to be able to mail webpages or articles from google reader to myself and have them imported with images into Devonthink.

That way if I come across something interesting while I’m at work, I don’t have to go through the process of remembering to look it up again and import it to Devonthink when I get home.

That requires DEVONthink Pro Office (as simple scripts can’t handle MIME parts of course).

I’m actually using Pro Office. How can I get the script to import the MIME parts? Even the “Import in Devonthink Pro Ofice” menu item hasn’t been importing the message as full HTML.

There is no script support for the Mail Import plugin and at this point in time it is not planned to add this (sorry!).

If you want to achieve your goal, you will need to add a lot more script code for Mail (or other mail program you are using) to ask it for the attachments and save those in DTPO as separate files. But that will not give you the same formatted text file that you’ll see through our import plugin, due to a limitation in AppleScript that prevents rich text to be transferred intact between applications.