Hello,
I’ve just subscribed, and I’m at my very first steps into the world of automation with Applescript. I’m very excited to become part of this community and I hope, one day, to be a contributor rather than just a beggar
The first script I’m working on is apparently quite simple, but I’m already running into a couple of troubles.
Context: I have two email addresses. I receive inquires from my commercial website to my personal email (e.g. personal@gmail.com) and when I reply I change my sender address to my company .com email address. I would like to create an Applescript that creates a reply message from the selected message in Mail.app and changes the sender email to the company email address (e.g. email@company.com).
I’ve already succeeded in this with the following script:
set MsgSender to "First Last <email@company.com>"
tell application "Mail"
set TheMessages to the selection
repeat with current_Message in TheMessages
set replyMessage to reply current_Message with opening window and reply to all
tell replyMessage
activate
set sender to MsgSender
end tell
end repeat
end tell
What’s the problem with this, then?
The problem is that the new message created by Applescript “reply” command is in a strange format (the original being HTML) and different from the same message created by click on CMD-R in the Mail.app.
I’ve created a screenshot to show you the difference.
The main difference is that the left email has the grey background only on the quoted part; the right-hand side email has grey on ALL the background.
So I’ve tried a different approach. I create the message by sending a keystroke CMD+R to Mail. This generates the email with the correct format that I like (left side of the image above). Now I need to manipulate the outgoing message to change the sender.
How do I send commands to the open window generated by CMD-R, so that I can change the sender?
An additional question: why is the format of the generated email different in the two cases? Shouldn’t it be the same?
Thanks in advance for all your help!