0
0
mirror of https://github.com/PHPMailer/PHPMailer.git synced 2024-09-20 01:52:15 +02:00
PHPMailer/test/fakesendmail.sh

23 lines
496 B
Bash
Raw Normal View History

#!/usr/bin/env bash
#Fake sendmail script, adapted from:
#https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce61f9f1ed3b4a9/init/fake-sendmail.sh
#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}
2016-08-31 10:26:06 +02:00
if [ ! -f ${numPath}/num ]; then
echo "0" > ${numPath}/num
fi
2016-08-31 10:26:06 +02:00
num=`cat ${numPath}/num`
num=$((${num} + 1))
echo ${num} > ${numPath}/num
2016-08-31 10:26:06 +02:00
name="${numPath}/message_${num}.eml"
while read line
do
2016-08-31 10:26:06 +02:00
echo ${line} >> ${name}
done
exit 0