Want to change sender of a received Apple Mail message

I am switching from Eudora to Apple Mail.
Two of the operations that you can do in Eudora are change:

  • the subject of a message that you have received
  • the sender of a message that you have received

I found an AppleScript that will let me change the subject, but I could not find one to change the sender.

I created an AppleScript to change the sender, but it does not work.


tell application "Mail"
	set theMessage to item 1 of (the selection as list)
	set the sender of theMessage to my getNewSender(sender of theMessage)
end tell
on getNewSender(OldSender)
	return text returned of (display dialog "Enter the new sender of the message and press Enter." default answer OldSender)
end getNewSender

What did I do wrong?
How do I make it work?

thanks

You have to ask the message viewer to get the selected messages:

tell application "Mail"
	tell message viewer 1 to set theMessage to item 1 of (get selected messages)
	set the sender of theMessage to text returned of (display dialog "New Sender, Please" default answer "")
	set NS to sender of theMessage
end tell
NS -- Note that the database name (NS) has been changed, but not the name displayed in the email. I don't know why.

Adam,

Thanks for the quick response, but it doesn’t do what I want/need.

You wrote: “Note that the database name (NS) has been changed, but not the name displayed in the email. I don’t know why.”

I actually do not care about what is in the database, I only care about what is displayed.

My purpose in having this functionality is to change those {infrequent) messages that I receive from a person’s “alter ego”. For example, normally I would have a bunch of emails from “John Smith”, but then he sends me one from his Hotmail account and with that he uses “Smith, John”. So, now when I sort on the From column, I don’t have all the messages from John together.