Mailsmith
Other Programs
Scripts
Mailsmith.scpt
Archive to sub-mailbox
Check Spelling
Find reply
Change font size
Submit Script to JEM
Fix common spelling errors
Setting SMTP server
URL from Safari
Address from AB
linkMunge
Export to Address Book
Saving attachments
Digest Script
File with same
POP window position
Position of new windows
iCal and Mailsmith
Edit From Line
Modified Thread Script
Reply to Selection
Temporary Text Window
Compact gain
Tracking backups
Edit subject
Googler
Auto-rewrap
MMA
SMTP server
Open, fetch, and close
URL Manager
BrainForest
Thread by Author
Thread by subject
Export Email
Get Selection
Read Addresses
Export Email
Organize Email
Account setup
Mailsmith 2 BBEdit
BBEdit 2 Mailsmith
Search II
Check One
Delete Enclosure
Open, fetch, close
Set Answered
Set Redirected
Empty Trash
List found
Print Several
Del. old. msg.
Delete Enclosures
Accounts
Address Book
Editing
Filters
General
Import/Export
Links
Mailboxes
Memory
Scripting
Speed
send/receive
Tips/Tricks


Open, fetch, and close

Author Gavan Schneider
Last modified 1998-02-03
What is this?

Suggest something like:

  • send queued mail
  • check mail
  • repeat until not connection in progress
    • delay 10 -- seconds
  • end repeat
  • RA disconnect

without the delay step the script is spinning the repeat loop very tight and would not be leaving much CPU time for Mailsmith to get the real work done.

For what it is worth here is a script I have developed (with help, thank you, from Christian Smith) to cycle through a list of email accounts. I have assumed the accounts have the "send mail when checking flag" set true so no separate command is used to send mail.

The motive was to allow each account to finish processing mail into the in box before starting another download of messages. This has improved the reliability of my mail in that I get less time out errors and therefore fewer repeat messages when the account is checked next time.

Adapt as needed.

Regards
Gavan

(see also the orginal version of the script)

on run
    try
        --start the application and setup list of mail account names
        tell application "Mailsmith 1.1"
            launch
            set accountList to name of mail accounts
        end tell
    on error
        -- nothin yet
    end try
    
    -- work through the list of accounts, and repeat this
    -- according to the number set below
    repeat 2 times
        repeat with theName in accountList
            CheckForMail(theName as string)
        end repeat
    end repeat
end run

to CheckForMail(AccountName)
    tell application "Mailsmith 1.1"
        -- do not attempt another account check if one is already in progress
        repeat while connection in progress
            -- do not hog the CPU while waiting for our time slot
            delay 10 -- seconds
        end repeat
        -- now start the mail account checking
        check mail using mail account AccountName
    end tell
end CheckForMail