How to make applescript 'Import selected mail' work?

This applescript, when used to import 2 selected emails (with plain text messages, no pictures or attachments), imports only the mail header and displays only a ‘?’ where the important part (the actual message!) should be.

I start the script from the Mail Applescript Menu.

I don’t want the headers in Devonthink, I want the message (and I mean, JUST the message, no headers at all, since that is useless info to me).

What am I doing wrong?

Regards,
Adelheid

Import works when:
Content-Type: text/plain; charset=“iso-8859-1”

Import doesn’t work when:
Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4C261.DB23219C"

Mail with content-type multipart are emails with notes I sent myself from my mail account at work (plain text I thought), to paste into Devonthink (done manually upto now).

Is there a way around this? (And a way to loose the header info?) Or do I have to change settings in my mail-account at work?

Thanks,
Adelheid

OK, edited the script and got rid of the headers. Question about the Content-Type remains.

Adelheid

Currently Apple’s Mail doesn’t return the body of an email if the email is a multipart-mime message. Therefore the only possibility to bypass this shortcoming is to use the “Take Rich Note” service (BTW: This command stores the sender’s address in the URL field of the new note since v1.9)

Do you mean incorporating that into the applescript? I see only a Devonthink import command in the script. And the file imported already has that ‘?’, so I think it goes wrong before Devonthink goes to work.

Regards,
Adelheid

No, services can’t be accessed via AppleScript and therefore you have to use the service on your own if an email can’t be captured via AppleScript.

OK, all clear. I will give that a try.

Thanks,
Adelheid