Skip to content

Instantly share code, notes, and snippets.

@jacobsalmela
Created January 12, 2015 19:59
Show Gist options
  • Save jacobsalmela/a5ea5c1fad0641249222 to your computer and use it in GitHub Desktop.
Save jacobsalmela/a5ea5c1fad0641249222 to your computer and use it in GitHub Desktop.
When paired with an Apple Mail rule, this will send a HTML-formatted response automatically to the sender
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with eachMessage in theMessages
set theName to extract name from sender of eachMessage
if exists reply to of eachMessage then
set theAddress to reply to of eachMessage
else
set theAddress to extract address from sender of eachMessage
end if
set customHTML to "<html><body><h1>Thanks</h1><p>for emailing me.</p></body></html>"
set newMessage to make new outgoing message with properties {html content:customHTML}
tell newMessage
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
set visible to false
set subject to "Re: " & subject of eachMessage
end tell
send newMessage
tell eachMessage
set was replied to to true
end tell
end repeat
end tell
end perform mail action with messages
end using terms from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment