File: fakesendmail.sh

package info (click to toggle)
libphp-phpmailer 5.2.14%2Bdfsg-2.3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,820 kB
  • sloc: php: 6,724; sh: 114; makefile: 13
file content (22 lines) | stat: -rwxr-xr-x 474 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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
mkdir -p $numPath

if [ ! -f $numPath/num ]; then
  echo "0" > $numPath/num
fi
num=`cat $numPath/num`
num=$(($num + 1))
echo $num > $numPath/num

name="$numPath/message_$num.eml"
while read line
do
  echo $line >> $name
done
exit 0