Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1140
  • Last Modified:

How can I use OS X Automator/Apple Script to change my email settings?

My OS X mail is giving me fits.  It frequently hangs up and stops downloading emails.  The only way I can get it working again is to restart Mail, or take all mail accounts offline and then back online.  I suspect it is a problem with one or more of my IMAP mailboxes, but Mac Mail is the only client that freezes up.  My iPhone mail works fine on all those accounts even when the Mac Mail won't

Anyway, not knowing how to fix the root of the problem, I want to create an automator script that takes my accounts offline and online again every 10 minutes whenever Mac Mail is running.  Does anyone know how to do that?
0
kenjaW
Asked:
kenjaW
  • 2
  • 2
1 Solution
 
lesouefCommented:
First check if Mail is applescriptable. if yes, then if the function to put your accounts on/off is available.
But fm my pt of view, you should fix the original problem. do you have the pb in pop mode?
0
 
kenjaWAuthor Commented:
The mailboxes all use IMAP.  I'm trying to solve the root of the problem, too, but have spent a considerable amount of time with no results.  

I'm enough of a newbie to apple script, that I don't even know where to look for which functions are scriptable.  It appears that there are apple scripts written for Mail, though.  
0
 
lesouefCommented:
I am not a mac man myself, but checking this is easy. once applescript editor is open, it can list all present apps which are compatible, then for each app, there is a lib of available functions. Also osX is shipped with lots a applescripts among which you may find what you need. Can't say more now, I don't have my mac with me...
to isolate you root problem, maybe you should try from another mac using the same application, to make sure it's not the app but your setup?
0
 
AGoodKeenManCommented:
I seem to remember, awhile ago something about how Mail connects and communicates with an IMAP server, that causes problems along the lines of what you are describing. However I don't remember a fix.
 The script is not an ideal solution to the problem, however, below is a script that does what you are asking for. If you add this script to your Mail scripts folder, you can trigger it from the scripts menu or by mapping an F key (System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts) to that menu item and run the script every time you push that key.
-----------------------------------------------------------------
-- Script to deactivate/activate all Mail accounts
-- and jog the IMAP connection
-----------------------------------------------------------------
 
tell application "Mail"
	activate
end tell
 
tell application "System Events"
	tell process "Mail"
		tell menu bar 1
			tell menu bar item "Mailbox"
				click menu item "Take All Accounts Offline" of menu 1
			end tell
		end tell
		tell menu bar 1
			tell menu bar item "Mailbox"
				click menu item "Take All Accounts Online" of menu 1
			end tell
		end tell
	end tell
end tell

Open in new window

0
 
kenjaWAuthor Commented:
Thanks for putting that together for me.  That'll get me limping along while I try to diagnose the root of the problem.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now