summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando J. Pereda <ferdy@gentoo.org>2005-04-26 18:16:41 +0000
committerFernando J. Pereda <ferdy@gentoo.org>2005-04-26 18:16:41 +0000
commitdf1338135eef13893d4589c55ca713475bf81220 (patch)
tree1d6ce174fa040ff1a491d216e50b5f647330fe38 /mail-mta/nbsmtp/files
parentfix mailer.conf (diff)
downloadhistorical-df1338135eef13893d4589c55ca713475bf81220.tar.gz
historical-df1338135eef13893d4589c55ca713475bf81220.tar.bz2
historical-df1338135eef13893d4589c55ca713475bf81220.zip
Add /usr/lib/sendmail if -mailwrapper, also install nbqueue
Package-Manager: portage-2.0.51.19
Diffstat (limited to 'mail-mta/nbsmtp/files')
-rwxr-xr-xmail-mta/nbsmtp/files/nbqueue91
-rwxr-xr-xmail-mta/nbsmtp/files/wrapper-nbsmtp4
2 files changed, 93 insertions, 2 deletions
diff --git a/mail-mta/nbsmtp/files/nbqueue b/mail-mta/nbsmtp/files/nbqueue
new file mode 100755
index 000000000000..bcfc56a90294
--- /dev/null
+++ b/mail-mta/nbsmtp/files/nbqueue
@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+
+##
+# nbQUEUE adds queue support for nbsmtp
+#
+# To use nbQUEUE just create ${QUEUEDIR} and then set
+# nbqueue as your sendmail program. To flush the queue
+# (i.e. send all queued mails) just run nbqueue --flush.
+##
+
+shopt -s nullglob
+
+QUEUEDIR=~/.nbsmtp/.queue
+
+messageid() {
+ sed -n -e '1,/^$/ {
+ /^Message-[iI][dD]: *<\([^>]*\)>.*$/s//\1/p
+ }' $1
+}
+
+messageinfo() {
+ sed -n -e '1,/^$/ {
+ /^From: .*$/p
+ /^To: .*$/p
+ /^[Bb]\?[cC]\{2\}: .*$/p
+ /^Subject: .*$/p
+ }' $1
+}
+
+[[ -d "${QUEUEDIR}" ]] || mkdir -p "${QUEUEDIR}" || {
+ echo "${0}: ${QUEUEDIR} does not exist and I cannot create it"
+ exit 1
+}
+
+case "$1" in
+ --flush|-f)
+ for i in ${QUEUEDIR}/* ; do
+ echo -n "Sending ${i}... "
+ nbsmtp < "${i}"
+
+ if [[ $? -eq 0 ]] ; then
+ rm "${i}"
+ echo "ok."
+ else
+ echo "failed, keeping message in queue."
+ fi
+ done
+ ;;
+ --list|-l)
+ echo "Showing queued mails in ${QUEUEDIR}:"
+ echo
+ for i in ${QUEUEDIR}/* ; do
+ echo "* <${i##*/}>"
+ echo
+ messageinfo "${i}"
+ echo
+ done
+ ;;
+ --wipe|-w)
+ echo "Removing mails in ${QUEUEDIR}:"
+ for i in ${QUEUEDIR}/* ; do
+ echo -e "\t${i##*/}"
+ rm "${i}"
+ done
+ ;;
+ --help|-h)
+ cat << EOH
+nbQUEUE Copyright (C) 2005 Fernando J. Pereda
+nbQUEUE is supplied with nbSMTP [ http://nbsmtp.ferdyx.org ]
+nbQUEUE and nbSMTP are released under the GPLv2
+
+${0##*/} [ action ]
+
+Possible actions are:
+ --flush | -f - Send all mails in the queue
+ --wipe | -w - Remove all mail in the queue
+ --list | -l - List all messages in the queue
+ --help | -h - Print this help message
+EOH
+ exit 0
+ ;;
+ --)
+ # Asume queue mode
+ tmpfile=$(tempfile)
+ cat - > ${tmpfile}
+ newname=$(messageid ${tmpfile})
+ mv "${tmpfile}" "${QUEUEDIR}/${newname}"
+ ;;
+esac
+
+exit 0
diff --git a/mail-mta/nbsmtp/files/wrapper-nbsmtp b/mail-mta/nbsmtp/files/wrapper-nbsmtp
index 66d3c41668a2..cd0abdf2ed41 100755
--- a/mail-mta/nbsmtp/files/wrapper-nbsmtp
+++ b/mail-mta/nbsmtp/files/wrapper-nbsmtp
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
_newaliases() {
- echo "${0}: nbSMTP does not support aliases"
+ echo "newaliases: nbSMTP does not support aliases"
}
case "${0##*/}" in
@@ -24,4 +24,4 @@ case "${0##*/}" in
;;
esac
-exit ${?}
+exit $?