Advertisement
Guest User

Turn on Logging.scpt

a guest
May 30th, 2010
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tell application "System Events"
  2.     set mailIsRunning to application process "Mail" exists
  3. end tell
  4.  
  5. if mailIsRunning then
  6.     display dialog "Please quit Mail and then run this program again." buttons {"OK"} default button "OK"
  7. else
  8.     set loggingOption to button returned of (display dialog "Enable socket logging for checking or sending mail.  Quit Mail to turn off logging." buttons {"Checking", "Sending", "Both"})
  9.    
  10.     tell application "Mail"
  11.         set portList to {}
  12.        
  13.         if loggingOption is in {"Checking", "Both"} then
  14.             repeat with eachAccount in every account
  15.                 set incommingPort to port of eachAccount as string
  16.                 if portList does not contain incommingPort then
  17.                     set end of portList to incommingPort
  18.                 end if
  19.             end repeat
  20.         end if
  21.        
  22.         if loggingOption is in {"Sending", "Both"} then
  23.             repeat with eachAccount in every account
  24.                 set outgoingPort to port of smtp server of eachAccount as string
  25.                 if portList does not contain outgoingPort then
  26.                     set end of portList to outgoingPort
  27.                 end if
  28.             end repeat
  29.         end if
  30.        
  31.         set ports to log activity on to portList
  32.     end tell
  33. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement