about summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2024-09-11 22:05:50 +0200
committerLeah Neukirchen <leah@vuxu.org>2024-09-11 22:05:50 +0200
commit648ecdafb34c706dc3f9101e72d951c71cc8eda1 (patch)
tree41650f1eeeb2c3982ce86baf8b6710f11a2a6530 /mcom
parent8bac54fab7c7657940b30915abb36f61093d11c9 (diff)
downloadmblaze-648ecdafb34c706dc3f9101e72d951c71cc8eda1.tar.gz
mblaze-648ecdafb34c706dc3f9101e72d951c71cc8eda1.tar.xz
mblaze-648ecdafb34c706dc3f9101e72d951c71cc8eda1.zip
mcom: add senthook
Closes #226.
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom10
1 files changed, 8 insertions, 2 deletions
diff --git a/mcom b/mcom
index 4d0362a..420ba15 100755
--- a/mcom
+++ b/mcom
@@ -104,6 +104,7 @@ sendmail=$(mhdr -h sendmail "$MBLAZE/profile")
 sendmail_args=$(mhdr -h sendmail-args "$MBLAZE/profile")
 sendmail="${sendmail:-sendmail} ${sendmail_args:--t}"
 default_from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+senthook=$(mhdr -h senthook "$MBLAZE/profile")
 
 defaultc=e
 
@@ -459,7 +460,10 @@ while :; do
 			if [ "$draft" -ot "$draftmime" ] || [ "$automime" = 1 ]; then
 				stampdate "$draftmime"
 				if $sendmail <"$draftmime"; then
-					if [ "$outbox" ]; then
+					if [ "$senthook" ]; then
+						mv "$draftmime" "$draft"
+						$senthook "$draft"
+					elif [ "$outbox" ]; then
 						mv "$draftmime" "$draft"
 						mrefile "$(mflag -d -S "$draft")" "$outbox"
 					else
@@ -478,7 +482,9 @@ while :; do
 			if mmime -c <"$draft" && ! [ "$automime" = 1 ]; then
 				stampdate "$draft"
 				if $sendmail <"$draft"; then
-					if [ "$outbox" ]; then
+					if [ "$senthook" ]; then
+						$senthook "$draft"
+					elif [ "$outbox" ]; then
 						mrefile "$(mflag -d -S "$draft")" "$outbox"
 					else
 						rm "$draft"