From 9f8ae1a3603fc36b53132563fab11cd86631562e Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 24 Dec 2015 15:53:17 +0100
Subject: [PATCH] Lessen mutt dependency.

---
 README             | 2 --
 pingmail           | 4 ++--
 pingmailrc.example | 3 +++
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/README b/README
index dfe8255..24f1892 100644
--- a/README
+++ b/README
@@ -1,7 +1,5 @@
 Small shell script to regularly check a target person's responsiveness via mail.
 
-Expects mutt to be usable for sending mails via command line.
-
 When run as "pingmail check", searches a maildir for the most recent file
 matching a regex pattern (such as a "From: " field matching the target person),
 and if the most recent file is too old, sends an e-mail to the target person
diff --git a/pingmail b/pingmail
index 5d97605..b59fa49 100755
--- a/pingmail
+++ b/pingmail
@@ -58,7 +58,7 @@ echo "Wait time since last life sign or ping sent: "$delta" seconds."
 # if delta > wait time, send reminder to person to check with, start reminder
 # mail timer if not in existence, re-touch ping wait file
 if [ "$delta" -gt "$wait_time" ]; then
-    echo $msg2checked | mutt -s "$subj2checked" $checked_address
+    echo $msg2checked | $mailclient_s "$subj2checked" $checked_address
     echo "Sending ping message."
     touch $ping_touch
     if [ ! -f "$reminder_touch" ]; then
@@ -78,7 +78,7 @@ if [ -f "$reminder_touch" ]; then
     else
         delta=`expr $now - $modtime_reminder`
         if [ "$delta" -gt "$wait_time" ]; then
-            echo $msg2checker | mutt -s "$subj2checker" $checker_address
+            echo $msg2checker | $mailclient_s "$subj2checker" $checker_address
             echo "Sending reminder message."
             rm $reminder_touch
             echo "Deleting reminder message wait time file."
diff --git a/pingmailrc.example b/pingmailrc.example
index 6ac22bd..97a9de0 100644
--- a/pingmailrc.example
+++ b/pingmailrc.example
@@ -34,6 +34,9 @@ msg2checker='pingmail reporting in:\n
 \nNo life signs from '$id_target' for the last '$reminder_time' seconds.
 \nMaybe you should give them a call to check if they are okay.'
 
+# mail client command reading message body from stdin and subject from parameter
+mailclient_s='mutt -s'
+
 # pattern to search $maildir for recursively for lifesigns
 checked_address_escaped=`echo $checked_address | sed 's/\./\\./g'`
 matchstring='^From: .*('$checked_address_escaped'|alternate@example\.org)'
-- 
2.30.2