New email from specific account

I am on the latest version of High Sierra. Everything is updated, including Keyboard Maestro.

I have a simple macro: Activate Mail->Send email message with Subject “”

I have only selected the outgoing account/sender. The macro merely opens a new email for me to send, from a specific secure account.

This has worked previously, but today it stopped. What is happening is that a new email message is opened, the sender address is the address at the top of my ‘From’ account list, and there is a duplicate entry for the secure email address I wish to send from in the ‘From’ pull-down in the new outgoing message pane.

I have tried recreating the macro from scratch, tried quitting Mail and Keyboard Maestro, and restarted the computer. No luck.

Peter suggested I enquire about creating an AppleScript here.

Thanks in advance for any help!

I have found a partial solution that depends on the GUI:

Activate Mail->Send Message (parameters left blank)->AppleScript:

tell application "System Events"
   activate application "Mail"
   tell pop up button "From:" of window 1 of application process "Mail"
      tell application "System Events" to key code 125 using {command down}
      tell application "System Events" to key code 36
   end tell
end tell

Fortunately, my desired email is at the bottom of the list, so it is easier to select.

Would still love to have an AppleScript that is more specific, so if there is a change in the order of email addresses in my ‘From’ list, this will still work, but there it is…

Hey @sawmri,

Take a look at this, and see if it helps.

How to send an email with AppleScript