Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F28484
newmail
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Apr 1 2016, 20:14
2016-04-01 20:14:52 (UTC+0)
Size
911 B
Referenced Files
None
Subscribers
None
newmail
View Options
#!/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
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25747
Default Alt Text
newmail (911 B)
Attached To
Mode
P184 newmail
Attached
Detach File
Event Timeline
Log In to Comment