summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@users.sourceforge.net>2007-08-08 15:53:42 +0000
committerJosé Fonseca <jrfonseca@users.sourceforge.net>2007-08-08 15:53:42 +0000
commitec82f965da3cf4853e56f2abcc42b7e7045f6530 (patch)
tree146ecd8b24f40746d9e834a5d0063b2ba63ce85d
parent31e51b71fdb15b7c96f33760a5544a1ab0ca63ae (diff)
Minor corrections.
-rwxr-xr-x[-rw-r--r--]esmtp-wrapper35
1 files changed, 17 insertions, 18 deletions
diff --git a/esmtp-wrapper b/esmtp-wrapper
index 4215c4b..c090465 100644..100755
--- a/esmtp-wrapper
+++ b/esmtp-wrapper
@@ -22,32 +22,32 @@ mktemp="/bin/mktemp"
queue_mail() { # ($@)
local ret=0
- mkdir -p $qdir || {
- echo "unable to create queue dir $qdir"
+ mkdir -p "$qdir" || {
+ echo "unable to create queue dir $qdir" 2>&1
return 1
}
- mdir="`$mktemp -d $qdir/XXXXXXXX`"
+ mdir="`$mktemp -d "$qdir/XXXXXXXX"`"
[ -d "$mdir" ] || {
- echo "unable to create tempdir inside $qdir"
+ echo "unable to create tempdir inside $qdir" 2>&1
return 1
}
- echo "$@" >$mdir/cmd || ret=1
- cat </dev/stdin >$mdir/mail || ret=1
+ echo "$@" >"$mdir/cmd" || ret=1
+ cat </dev/stdin >"$mdir/mail" || ret=1
[ $ret -eq 0 ] || {
- echo "could not enqueue mail in dir $mdir"
+ echo "could not enqueue mail in dir $mdir" 2>&1
return 1
}
- chmod 0600 $mdir/* || echo "warning setting secure permissions failed!"
+ chmod 0600 $mdir/* || echo "warning setting secure permissions failed!" 2>&1
return 0
}
show_mail() { # ($mdir)
echo "mail in dir $1:"
- printf '\t%s' "`grep ^From: $1/mail`"
- printf '\t%s' "`grep ^To: $1/mail`"
- printf '\t%s\n' "`grep ^Date: $1/mail`"
+ printf '\t%s' "`grep ^From: "$1/mail"`"
+ printf '\t%s' "`grep ^To: "$1/mail"`"
+ printf '\t%s\n' "`grep ^Date: "$1/mail"`"
}
show_queue() { # ()
@@ -60,10 +60,9 @@ show_queue() { # ()
echo "$i mails to deliver"
}
-
send_mail() { # ($mdir)
- $esmtp $(<$1/cmd) <$1/mail && \
- rm -rf $1 || return 1
+ $esmtp $(<"$1/cmd") <"$1/mail" && \
+ rm -rf "$1" || return 1
return $?
}
@@ -72,16 +71,16 @@ deliver_queue() { # ()
for dir in $qdir/*; do
[ ! -d "$dir" ] && continue
sleep 5 # allow tunnel to close properly
- send_mail $dir
+ send_mail "$dir"
undelivered=`expr $undelivered + $?`
done
return $undelivered
}
-ME=`basename $0`
-case $ME in
+ME=`basename "$0"`
+case "$ME" in
sendmail)
- queue_mail $@
+ queue_mail "$@" || return 1
deliver_queue &
;;
deliver)