2013-05-10 03:18:16 +02:00
|
|
|
#!/usr/bin/env bash
|
2013-02-02 18:41:54 +01:00
|
|
|
#Fake sendmail script, adapted from:
|
|
|
|
#https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce61f9f1ed3b4a9/init/fake-sendmail.sh
|
|
|
|
|
2013-05-10 03:18:16 +02:00
|
|
|
#Create a temp folder to put messages in
|
|
|
|
numPath="${TMPDIR-/tmp/}fakemail"
|
|
|
|
umask 037
|
2016-08-31 10:26:06 +02:00
|
|
|
mkdir -p ${numPath}
|
2013-02-02 18:41:54 +01:00
|
|
|
|
2016-08-31 10:26:06 +02:00
|
|
|
if [ ! -f ${numPath}/num ]; then
|
|
|
|
echo "0" > ${numPath}/num
|
2013-02-02 18:41:54 +01:00
|
|
|
fi
|
2016-08-31 10:26:06 +02:00
|
|
|
num=`cat ${numPath}/num`
|
|
|
|
num=$((${num} + 1))
|
|
|
|
echo ${num} > ${numPath}/num
|
2013-02-02 18:41:54 +01:00
|
|
|
|
2016-08-31 10:26:06 +02:00
|
|
|
name="${numPath}/message_${num}.eml"
|
2013-02-02 18:41:54 +01:00
|
|
|
while read line
|
|
|
|
do
|
2016-08-31 10:26:06 +02:00
|
|
|
echo ${line} >> ${name}
|
2013-02-02 18:41:54 +01:00
|
|
|
done
|
2013-05-10 03:18:16 +02:00
|
|
|
exit 0
|