Compose an email with AppleScript

I have recently committed to send every Friday an update email to someone at work. Few lines need change from week to week. I have written a simple AppleScript script to help me do it.

set recipientName to "John Snow"
set recipientAddress to "jsnow@gameofthrones.example"
set theSubject to "Winter is Comming"
set theContent to "Hi 

I have seen white walkers in the following spots: 

XXX

Thanks,
Sergio"

tell application "Mail"
    
    set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
    
    tell theMessage
        make new to recipient with properties {name:recipientName, address:recipientAddress}
    end tell
end tell

Not every detail of the email is completely automated. Hence, I need to fill some details before clicking send.

If you have every detail ready, you can send the emails directly from AppleScript with the send keyword.

Tags: #automation #applescript
Aug 2021, 02.

 

My next events:
🗓 Oct 05 17:00 Jumpstart your Java applications with AWS Lambda and Micronaut