Solving AppleScript Error with Lion Mail in forwarding email
So I've long used a set of AppleScripts to do some spam-handling. I got these working little more than a week before Leopard was released, and they've survived the last two updates. Sadly, they break in Lion Mail. Upon selecting messages in Mail, the script is designed to use the source of each message to create a new message. The new message will have the subject and content to the source message and will be sent to spam@uce.gov (or spoof@paypal.com). The source message then gets marked as read and moved into a spam-learning folder with my mail provider. The forwarding may be of little value, but seeding known-spam into their folders will directly help my email experience.
tell application "Mail"
set theMessages to the selection
repeat with thisMessage in theMessages
set newMessage to make new outgoing message at end of outgoing messages
tell newMessage
set content to thisMessage's source
set subject to thisMessage's subject
make new to recipient with properties {address:"spam@uce.gov"}
end tell
send newMessage
set junk mail status of thisMessage to true
set read status of thisMessage to true
move thisMessage to mailbox "INBOX/ConfirmedJunk" of account "GFMorris.net"
end repeat
end tell
Here's the error I get:
Mail got an error: Can’t make source of message id 630957 of mailbox "INBOX/Junk Mail" of account "GFMorris.net" into type rich text.
I dinked around with preferences in Mail about rich v. plain text (I'm a plain text, fixed-width person), but that error seems to say that it can't get the source of the message at all. That tells me that the "repeat with thisMessage..." loop is broken, as it's not getting the source. I checked the AppleScript dictionary for Lion Mail and didn't see anything obvious.
Does anyone have any ideas? I'm just foregoing the script for now, but I'd love to have something that works.
27, Mac OS X (10.7)