dot

packages and services management
Log | Files | Refs | README

commit 108db050c2c07d424fcba6fe6c7eaa9545376f66
parent acdcc64485668f4b2a6b0b64ca8b001b7fc8df1c
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun,  2 Dec 2018 17:05:47 +0100

bin/mail-{rep,write}: reply to an e-mail

Diffstat:
Mbin/mail-rep | 38++++++++++++++++++++++++++++++++++++--
Mbin/mail-write | 13++++++++-----
2 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/bin/mail-rep b/bin/mail-rep @@ -1,4 +1,38 @@ #!/usr/bin/env execlineb -elgetpositionals +importas -i mail 1 +shift -n 1 -mrep $@ +backtick -n USER { whoami } +importas USER USER +backtick -n HOME { homeof $USER } +importas HOME HOME +importas -D ${HOME}/.mblaze MBLAZE MBLAZE + +backtick -n x { mseq ${mail} } +importas mail x + +backtick -n x { maddr -a -h local-mailbox:alternate-mailboxes: ${MBLAZE}/profile } +importas me x + +backtick -n Cc { + pipeline { mhdr -d -h cc ${mail} } + grep -Fv ${me} +} + +backtick -n To { + pipeline { mhdr -d -h to ${mail} } + grep -Fv ${me} +} + +importas To To +backtick -n -D ${To} To { + pipeline { mhdr -d -h reply-to ${mail} } + grep -Fv ${me} +} + +backtick -n From { mhdr -h local-mailbox ${MBLAZE}/profile } +backtick -n Message-Id { mhdr -d -h message-id ${mail} } +backtick -n Date { mdate } +export Body ${mail} + +mail-write ${recipients} diff --git a/bin/mail-write b/bin/mail-write @@ -4,12 +4,12 @@ backtick -n USER { whoami } importas USER USER backtick -n HOME { homeof $USER } importas HOME HOME -importas -D ${HOME}/.mblaze MBLAZE MBLAZE +importas -D "${HOME}/.mblaze" MBLAZE MBLAZE -backtick -n -D ${HOME}/mail/OUTBOX x { mhdr -h outbox ${MBLAZE}/profile } +backtick -n -D "${HOME}/mail/OUTBOX" x { mhdr -h outbox "${MBLAZE}/profile" } importas outbox x -backtick -n x { redirfd -r 0 /dev/null mdeliver -v -XD ${outbox} } +backtick -n x { redirfd -r 0 "/dev/null" mdeliver -v -XD "${outbox}" } importas draft x multisubstitute { @@ -20,6 +20,7 @@ multisubstitute { importas -n Message-Id Message-Id importas -n Subject Subject importas -n To To + importas -n Body Body } if { @@ -32,7 +33,9 @@ if { if { echo Date: ${Date} } if { echo Message-Id: ${Message-Id} } if { museragent } - printf "\n\n" + if { echo } + if -t { test "${Body}" } + cat "${Body}" } -mail-draft ${draft} +mail-draft "${draft}"