Postfach einfügen

Guten Tag,
ich würde gerne ein Postfach von mail in Devonthink pro einfügen. Dort erscheint eine leere mbox. Ist das irgendwie möglich?

Gruß,
Stefan Höse

Siehe mitgeliefertes AppleScript: Add mailbox(es) to DEVONthink

Gruss,
Clemens Giegerich

Danke. Importieren hat geklappt. Das Postfach wird anscheinend nicht laufend aktualisiert wie beispielsweise Web-Archive. Gibt es hierfür eine Möglichkeit?

MfG
Stefan Höse

Ist nur ein Import. Ein automatisches Hinzufügen kann über ein Mail-Regel und einem Applescript erreicht werden. Siehe hierzu mitgeliefertes Script: Mail/Mail Rule Action Import. Um die Mails in einen vorgegebenen Ordner zu speichern habe ich das Skript ein wenig erweitert. Hier ein Beispiel:


-- Mail Rule Action Import to DEVONthink Pro.
-- Created by Christian Grunenberg on Mon Apr 19 2004.
-- Copyright (c) 2004-2005. All rights reserved.

-- this string is used when the message subject is empty
property pNoSubjectString : "(no subject)"

-- entry point
using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		tell application "Mail"
			repeat with theMessage in theMessages
				my importMessage(theMessage)
			end repeat
		end tell
	end perform mail action with messages
end using terms from

on importMessage(theMessage)
	tell application "Mail"
		try
			set theDateReceived to the date received of theMessage
			set theDateSent to the date sent of theMessage
			set theSender to the sender of theMessage
			set theSubject to subject of theMessage
			if theSubject is equal to "" then set theSubject to pNoSubjectString
			
			set theContent to content of theMessage
			if (length of theContent ? 5) then
				
				set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ","}
				set theCC to (address of cc recipient of theMessage) as string
				set theBCC to (address of bcc recipient of theMessage) as string
				set theRecipient to (address of to recipient of theMessage) as string
				set AppleScript's text item delimiters to od
				
				set theHeaders to "From: " & theSender & return
				set theHeaders to theHeaders & "Subject: " & theSubject & return
				set theHeaders to theHeaders & "Date: " & (theDateSent as string) & return
				if (length of theRecipient is greater than 0) then
					set theHeaders to theHeaders & "To: " & theRecipient & return
				end if
				if (length of theCC is greater than 0) then
					set theHeaders to theHeaders & "CC: " & theCC & return
				end if
				if (length of theBCC is greater than 0) then
					set theHeaders to theHeaders & "BCC: " & theBCC & return
				end if

				tell application "DEVONthink Pro"
					set thedestination to create location "/Java/Mails/"
					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 thedestination
				end tell
			else
				set theContent to the source of theMessage
				tell application "DEVONthink Pro"
					set thedestination to create location "/Java/Mails/"
					create record with {name:theSubject, type:txt, creation date:theDateSent, modification date:theDateReceived, URL:theSender, plain text:(theContent as string)} in thedestination
				end tell
			end if
			set the flagged status of theMessage to true
		end try
	end tell
end importMessage

/Java/Mails/ muss entsprechend angepasst werden.
Ein komplexeres Skript, dass die Mailbox mit der DevonThink-Gruppe synchronisiert ist auch denkbar.

Gruss,
Clemens Giegerich