mcom: only generate multipart mime mails when using attachments

pull/28/head
Leah Neukirchen 7 years ago
parent ad9fe95761
commit 2895704eee

25
mcom

@ -23,6 +23,11 @@ msgdate() {
mdate
}
needs_multipart() {
mhdr -h attach "$1" >/dev/null ||
grep -q '^#[^ ]*/[^ ]* ' "$1"
}
MBLAZE=${MBLAZE:-$HOME/.mblaze}
sendmail=$(mhdr -h sendmail "$MBLAZE/profile")
@ -156,14 +161,20 @@ while :; do
exit 1
;;
m|mime)
(
IFS='
if needs_multipart "$draft"; then
(
IFS='
'
msed '/attach/d' $draft
for f in $(mhdr -M -h attach $draft); do
printf '#%s %s\n' "$(file -Lbi $f | sed 's/ //g')" "$f"
done
) | mmime >$draftmime
msed '/attach/d' $draft
for f in $(mhdr -M -h attach $draft); do
printf '#%s %s\n' \
"$(file -Lbi $f | sed 's/ //g')" \
"$f"
done
) | mmime >$draftmime
else
mmime -r <"$draft" >"$draftmime"
fi
mshow -t $draftmime
c=
;;

Loading…
Cancel
Save