I’m working on a pretty basic script to create a reply to the selected messages which sets the sender address to the address the email was originally sent to. (I have multiple email aliases which all resolve to the same account.)
global theAccount
tell application "Mail"
set curMessages to selected messages of first message viewer
repeat with cm in curMessages
if exists (headers of cm whose name is "X-Delivered-To") then -- The intended recipient alias is saved in this header
set theAccount to content of (first header of cm whose name is "X-Delivered-To")
else -- Just put in an address from the account
set theAddresses to email addresses of account of mailbox of cm
set theAccount to first item of theAddresses
end if
get theAccount
set theReply to reply cm with reply to all and opening window
set sender of theReply to theAccount
end repeat
end tell
The problem here is that theReply remains undefined. When I send a tell application “Mail” to get all outgoing messages, I get the confusing response of {Application “Mail”}. (Same bug noted here, which doesn’t contain a response.)
Any thoughts on how to get around this? I’ve tried changing the reply cm… statement to include properties {sender:theAccount}, but that doesn’t seem to work. I can’t attach properties to a reply command.
–Nik