Supporting PowerMail

Would it be difficult to modify the mail scripts to import selected PowerMail messages? I’m not very familiar with Applescript, so I don’t know if I have to dig in to PowerMail’s scripting commands to change things or if those references might be standard.


i’d love to figure this out, too. i just switched from Entourage X to PowerMail (great app) and would love to be able to import messages (including header info) into DT Pro. any tips on how to get this done would be greatly appreciated.

The final build of DEVONthink Pro will include this script:

-- Import Selected PowerMail messages to DEVONthink Pro.
-- Created by Christian Grunenberg on Sun Jul 31 2005.
-- Copyright (c) 2005. All rights reserved.

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

tell application "PowerMail"
	set theSelection to current messages
	if length of theSelection is greater than 0 then
		repeat with theMessage in theSelection
			my importMessage(theMessage)
		end repeat
		display dialog "One or more messages must be selected." buttons {"OK"} default button 1 with icon caution
	end if
end tell

on importMessage(theMessage)
	tell application "PowerMail"
			set theDate to the time received of theMessage
			set theSender to the sender of theMessage
			set theAddress to the email address of theSender
			if theAddress is equal to "" then set theAddress to display name of theSender
			set theSubject to subject of theMessage
			if theSubject is equal to "" then set theSubject to pNoSubjectString
			set theHTML to HTML content of theMessage
			if theHTML is equal to "" then
				set theContent to content of theMessage
				set theHeaders to (headers of theMessage)
				tell application "DEVONthink Pro" to create record with {name:theSubject, type:txt, date:theDate, URL:theAddress, plain text:(theHeaders as string) & return & (theContent as string)}
				tell application "DEVONthink Pro" to create record with {name:theSubject, type:html, date:theDate, URL:theAddress, source:theHTML}
			end if
		end try
	end tell
end importMessage

Please let me know if this works as expected - thanks!

It works for me. Importing one or more messages (text or html) is a snap and if nothing is selected the reminder to select something pops up.

I’m guessing I could open PowerMail’s dictionary to find those specific elements I’d like to include or not–for instance, this script imports all the headers, most of which I’d guess I have no use.

Thanks for putting this together. It’s going to be a great help.


thank you guys SO much for creating this for us.

is there a way to pare down the header info?

The script included in DT Pro 1.0.1 uses short headers.

thanks Charles.

Thing is, the headers I’m importing now with the new version still have a whole bunch of superfluous stuff. If they’re shorter than the previous ones, it’s not by much. Problem is I manually deleted all the extraneous stuff from previous imports so I have nothing to compare it to. I haven’t done a restart or logout since installing the new version but I have quit and restarted both DT Pro and PM, I wonder if that’s it.

I guess what I’m saying is if what I’m seeing is indeed the ‘pared down’ version, my vote would be for more paring.

But again, I’m just thrilled to have this capability at all, it makes my life a lot easier. Thanks for a great product.

Did you use the new script? (see folder “Scripts > Script Menu > Applications > PowerMail > …” on disk image). Then the headers should only include From, To, Date & Subject.

Charles…user error strikes again. I spaced out moving the new script file into the powermail script folder.

Terrific job, thank you, it’s exactly as I wanted it!