Page MenuHomeDevCentral
Authored By
dereckson
Apr 1 2016, 20:14
Size
911 B
Referenced Files
None
Subscribers
None
#!/usr/bin/env tclsh8.5
#Checks if there is a new mail in Maildir folders
#
# Helper methods
#
#Gets maildir directory
proc get_maildir {} {
global env
if [info exists env(MAILDIR)] {
return $env(MAILDIR)
}
return $env(HOME)/Maildir
}
#Return "s" when amount needs a plural
proc s {amount} { if {$amount >= 2} {return "s"} }
#
# Procedural code
#
#Checks if Maildir exists
if [file exists [set maildir [get_maildir]]] {
#Yes, check new mails
set nb [llength [glob -nocomplain -directory $maildir/new *]]
if {$nb > 0} {
puts ""
puts "*** You have $nb new mail[s $nb]"
puts ""
}
} {
#No, ask to create it
puts "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
puts " You don't have setup your mail delivery."
puts ""
puts " Please run the following command:"
puts " /var/qmail/bin/maildirmake $maildir"
puts "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25747
Default Alt Text
newmail (911 B)

Event Timeline