Jun 15, '04 10:13:00AM • Contributed by: alanb1979
The problem is that with both mail programs running at once, they would compete for the IMAP connection and complain. So, I wanted a simple way to quickly & gracefully quit Mail.app remotely. I know I could use killall Mail, but I wanted something that would save any mail being composed and such, so ApplesSript was the answer.
I ended up adding the following two lines to my .profile (I like .profile for config better than .bash_login because it seems to get used by X11 and Terminal.app). It's just a simple inline Applescript:
Please enter any better ideas in the comments ... I'm open to better approaches!
# make it easy to remotely quit Mail.app alias quitmail='osascript -e "quit application "Mail" saving yes"'