summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul C. Buetow (mars.fritz.box) <paul@buetow.org>2014-07-05 00:23:53 +0200
committerPaul C. Buetow (mars.fritz.box) <paul@buetow.org>2014-07-05 00:23:53 +0200
commitc64e69af42bcd3265b75c86b84e68b29225f229a (patch)
tree05b592e3141a2975d79c1a83701cd869716ab6a4
parentbf90eca598bb510af22617dbbb15af3b599cc268 (diff)
using mutt instead of msmtp0.2.0
-rw-r--r--Makefile1
-rw-r--r--debian/control4
-rw-r--r--docs/muttdelay.pod19
-rw-r--r--src/msmtprc.sample15
-rwxr-xr-xsrc/muttdelay12
-rw-r--r--src/muttdelay.default.conf1
6 files changed, 17 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index 2ac3a32..7f67778 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,6 @@ install:
test ! -d $(DESTDIR)/etc/default && mkdir -p $(DESTDIR)/etc/default || exit 0
cp ./src/muttdelay.default.conf $(DESTDIR)/etc/default/muttdelay
cp ./src/*.vim $(DESTDIR)/usr/share/$(NAME)/
- cp ./src/*.sample $(DESTDIR)/usr/share/$(NAME)/
deinstall:
test ! -z "$(DESTDIR)" && test -f $(DESTDIR)/usr/bin/$(NAME) && rm $(DESTDIR)/usr/bin/$(NAME) || exit 0
diff --git a/debian/control b/debian/control
index 48f5502..d461ea6 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Vcs-Browser: https://github.com/rantanplan/muttdelay
Package: muttdelay
Architecture: all
-Depends:
+Depends: procmail, mutt
Description: Delaying the sending of mails
- A bash script to delay mails written via mutt and msmtp.
+ A bash script to delay mails written via mutt
diff --git a/docs/muttdelay.pod b/docs/muttdelay.pod
index 13ac1aa..3f4a74c 100644
--- a/docs/muttdelay.pod
+++ b/docs/muttdelay.pod
@@ -21,24 +21,13 @@ And create an hourly cronjob such as:
0 * * * * /usr/bin/muttdelay cron
-=head3 Configuring msmtp
+=head3 Configuring Mutt
-You may use other command which can send an email instead. But this has been tested with msmtp only.
+Configure mutt your way and ensure that you can send mails like this:
-It can be configured for example like this (change your configuration accordingly to fit your needs):
+ mutt -s subject example@example.com mail.txt
- cp /usr/share/muttdelay/msmtprc.example ~/.msmtprc
- vim ~/.msmtprc
-
-And ensure that you can send mails like this:
-
- msmtp your@address.example.com <<< Hallo
-
-If it works, you can go on. Or if you want to use another command to send mails just edit
-
- /etc/default/muttdelay
-
-accordingly.
+If it works, you can go on.
=head3 Use it
diff --git a/src/msmtprc.sample b/src/msmtprc.sample
deleted file mode 100644
index cd2c748..0000000
--- a/src/msmtprc.sample
+++ /dev/null
@@ -1,15 +0,0 @@
-defaults
-tls on
-tls_certcheck off
-#tls_trust_file /etc/ssl/certs/ca-certificates.crt
-#logfile ~/tmp/debug.log
-
-account myaccount
-host smtp.example.org
-from example@example.org
-auth on
-user myuser
-password mypass
-
-account default : myaccount
-
diff --git a/src/muttdelay b/src/muttdelay
index 66ed6ff..4d9dfb6 100755
--- a/src/muttdelay
+++ b/src/muttdelay
@@ -18,10 +18,20 @@ USAGE
cron () {
ls "${QUEUE}" |
+ grep -v .body |
while read mail; do
when=$(sed -E 's/^([0-9]+)\..*/\1/' <<< "${mail}")
if [ ${NOW} -gt ${when} ]; then
- $MAILCMD < "${QUEUE}/${mail}" && rm "${QUEUE}/${mail}"
+ fullpath="${QUEUE}/${mail}"
+ to=$(formail -xto: < "${fullpath}")
+ cc=$(formail -xcc: < "${fullpath}")
+ bcc=$(formail -xbcc: < "${fullpath}")
+ subject=$(formail -xsubject: < "${fullpath}")
+
+ sed '1,/^$/d' "${fullpath}" > "${fullpath}.body"
+
+ mutt "${to}" -s "${subject}" -c "${cc}" -b "${bcc}" \
+ < "${fullpath}.body" && rm "${fullpath}"*
fi
done
}
diff --git a/src/muttdelay.default.conf b/src/muttdelay.default.conf
index 68f670b..1f1e8e1 100644
--- a/src/muttdelay.default.conf
+++ b/src/muttdelay.default.conf
@@ -1,2 +1 @@
declare -r QUEUE="${HOME}/.muttdelay"
-declare -r MAILCMD='msmtp -t'