diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/msmtprc.sample | 15 | ||||
| -rwxr-xr-x | src/muttdelay | 12 | ||||
| -rw-r--r-- | src/muttdelay.default.conf | 1 |
3 files changed, 11 insertions, 17 deletions
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' |
