mail.app – Generating an email with an inline text link in it via AppleScript


I’m generating emails (without automatically sending them) with the following AppleScript and would like to replace the long_ugly_url with a text link in the email, but not sure how.

set theList to {{name:"John", email:"[email protected]", address:"Street Address, Pensacola, FL 32505"}, {name:"Janice", email:"[email protected]", address:"Street Address, New York, NY 10019"}--etc}

set theSubject to "This still a good mailing address?"

repeat with a from 1 to length of theList
    set cur to item a of theList
    set theBody to "Hey " & name of cur & ", blablabla" & return & "long_ugly_url"

    set theAddress to email of cur
    
    tell application "Mail"
        set theNewMessage to make new outgoing message with properties {sender:"Me <[email protected]>", subject:theSubject, content:theBody & return & return, visible:true}
        tell theNewMessage
            set visibile to true
            make new to recipient at end of to recipients with properties {address:theAddress}
        end tell
    end tell
end repeat

Suggestions, direction?

Thanks much.



Source link

Related Posts

About The Author

Add Comment