26 lines
569 B
Bash
26 lines
569 B
Bash
qp () {
|
|
perl -MMIME::QuotedPrint -s -ne '
|
|
BEGIN { *e = $d ? \&decode_qp : \&encode_qp }
|
|
print e $_
|
|
' -- "$@"
|
|
}
|
|
rm mbox
|
|
for f in input/*.md
|
|
do
|
|
f=${f##*/}
|
|
title=${f%.md}
|
|
subject=$(echo $title|qp -e)
|
|
|
|
uid=$(cat /proc/sys/kernel/random/uuid)
|
|
cp imap-note-header "$title".imap
|
|
sed -i "s/uid/${uid}/" "$title".imap
|
|
sed -i "s/title/${subject}/" "$title".imap
|
|
sed -i "s/name/$1/" "$title".imap
|
|
sed -i "s/email/$2/" "$title".imap
|
|
|
|
cat "input/$f" | qp -e >> "$title".imap
|
|
cat "$title".imap >> mbox
|
|
printf '\n\n' >> mbox
|
|
rm "$title".imap
|
|
done
|