proc backup {} { # Backup Header h1 \ -background gray\ -text "Backup of all mail" CheckBox all \ -text "backup all incoming messages to file:"\ -default 1 File-Dir-Browser all_file -default ~/Mail/backup Frame all_frm \ -entries all frame_all_file Header h2 \ -background gray\ -text "Backup of delivered mail" fileTemplate delivered 0 1 entry file\ "File to save to"\ {backup-delivered-%delivered_date%Year% %4% %08% %Mon%-%delivered_date%Month% %4% %Aug% %Mon%} Radio delivered \ -entries {"Backup All delivered mail"}\ {"Specify, for each recipe, whether the message should be backed up"}\ -count 1 Header h3\ -background gray\ -text "Backup of undelivered mail" CheckBox undelivered \ -text "Backup undelivered mail" fileTemplate undelivered 0 1 entry file \ "File to save to"\ {backup-undelivered-%undelivered_date%Year% %4% %08% %Mon%-%undelivered_date%Month% %4% %Aug% %Mon%} ################################################## ### Help ################################################## Desc \ "On this page, you can configure three different backup"\ "mechanisms:\n 1) backup of all incoming mail, before any other"\ "part of the generated procmail file is processed. This is a"\ "precaution, which guarantees that any bug in or misuse of, the"\ "module, will not destroy your mail.\n 2) The second is"\ "backup of all mail, that is matched by a recipe. This makes it"\ "possible to check what mail is placed where.\n 3) The last"\ "is daily backup of mail, which is not matched by any"\ "recipe. This is usually mail, which does not come from a"\ "mailing list, and is not garbage." foreach elm {h1 all frame_all_file com_all_file all_file} { Help $elm \ "To avoid any mail getting lost for any reason, all"\ "incoming mail can be saved to a file, at the start of every"\ "procmail session. This should only be done in the beginning,"\ "since all mail (including mail from mailing lists etc) will be"\ "written to this file.\n To get a daily backup of mail, please"\ "use the backup mechanism below. This one is only useful in"\ "the beginning!" } Help h2 \ "Delivered mail is mail, which doesn't make it to the user's"\ "incoming mailbox. The mail may either be written to a file,"\ "forwarded to an other user, or piped to an external program." Help delivered \ "When a message is matched by a recipe, you may wish to make a backup"\ "of it (in the beginning) to ensure that no mail is lost. Here"\ "you may select whether all matched recipes should make a backup"\ "or only the ones you specify. On each recipe, you can"\ "specify whether the message should be backed up if it matches." foreach elm {h3 undelivered} { Help $elm \ "Undelivered mail is mail, which makes it the whole way through"\ "your procmail file, and ends up in your incoming mailbox." } ###################################################################### ### PageEnd, Change, Save ###################################################################### set test { set dir [file dirname $all_file] if {![file exists $dir]} { set answer [tk_dialog .error "Directory does not exixt" "The directory \"$dir\" does not exist. It is necessary for procmail that this directory exist, shall I create it?" error 0 Yes No] if {$answer == 0} { createDir $dir } } } PageEnd "$test" Save "$test" Change { if {$changeElm == "undelivered"} { eval [pick $undelivered Enable Disable] \ undelivered_file [pick {$__system(mailhost,gzip) == ""} "" undelivered_gzip] } if {$changeElm == "all"} { eval [pick $all Enable Disable] all_file } } Save { if {$all} { print "\#\#\# backup of all incoming messages" print ":0c:" set dir [convertTilde [file dirname $all_file]] set file [file tail $all_file] print $dir/$file\n } } }