Scripting in Mail app

:shock: Any examples of how to send mail via applescript to the mail app in osx and also moving messages from one folder to another with applescript? Any help would be appreciated! Thanks

There’s a good collection of Mail scripts here:
http://homepage.mac.com/aamann/Mail_Scripts.html

You can direct download them here (These are run-only):
http://homepage.mac.com/aamann/MailScripts.sit

And you can download them in source code form here:
http://homepage.mac.com/aamann/MailScripts.src.sit

There’s bound to be something in there to get you started. :wink:

To move messages from one folder to another requires changing a property of the message to be moved. This should move the selected message(s) to another folder (mailbox).

tell application "Mail"
	set selectedMessages to selection
	repeat with thisMess in selectedMessages
		set mailbox of thisMess to mailbox "Mom" -- A mailbox named "Mom"
	end repeat
end tell

As far as sending messages, have you checked the example scripts? They should have been installed by default. A search for a folder named “Mail Scripts” should reveal several scripts. :slight_smile:

Thanks Rob and TJ for your help… those scripts are trickier than usuall but they will work fine. Thanks again! :smiley: