#!/p/kd/fdc/mm-pop/wermit + # Tue Dec 6 12:10:23 2005 # # mailcheck # # Cunix new-mail checker for use with MM. # Checks POP server for new mail every 5 minutes. # # Directions: start this script in its own window and enter your password # when requested (you only have to do this once). Let the script run until # you're ready to leave, then interrupt the script with Ctrl-C and log out. # # If new mail is present, it is moved from the POP server to ~/.mm-newmail # and a beeping message is printed. The next time MM is activated it will # read in the new mail. Note: This script is just the looping wrapper for # another script, pop.ksc, that does the real work. # # The initial test releases of these scripts are rather verbose. # For now, the scripts run only in the foreground. # # Frank da Cruz, CUIT, fdc@columbia.edu, Nov-Dec 2005 .host = pop.columbia.edu:995 # Current (old) server if exist ~/.cyrustt { # Cyrus (new) server .host = pop.columbia.edu:995 } .sleep ::= 5*60 # Check interval = 5 minutes .mypath := \fstripx(\%0,/) # Directory where this script lives while not def pass { # Get password (once) askq /echo:* pass \$(USER)'s Password: } .dest := \fpathname(~/.mm-newmail) # Destination file for new mail .date := 0 # Creation date of new mail file while true { # New-mail getting loop take \m(mypath)/pop.ksc \m(host) \m(dest) \m(pass) # Run the POP script if fail exit 1 # Don't loop if password was wrong echo "--------" if exist \m(dest) { # Show results .prev := \m(date) .date := \fdate(\m(dest)) if eq "\m(prev)" "\m(date)" echo MAIL WAITING: else echo \{7}NEW MAIL:\{7} grep /nopage "^From " \m(dest) } echo \v(time) - SLEEP \m(sleep)... echo "--------" sleep \m(sleep) # Sleep and then loop again if kbhit clear keyboard-buffer # Clear out any typing }