fakesendmail.sh 474 B

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. #Fake sendmail script, adapted from:
  3. #https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce61f9f1ed3b4a9/init/fake-sendmail.sh
  4. #Create a temp folder to put messages in
  5. numPath="${TMPDIR-/tmp/}fakemail"
  6. umask 037
  7. mkdir -p $numPath
  8. if [ ! -f $numPath/num ]; then
  9. echo "0" > $numPath/num
  10. fi
  11. num=`cat $numPath/num`
  12. num=$(($num + 1))
  13. echo $num > $numPath/num
  14. name="$numPath/message_$num.eml"
  15. while read line
  16. do
  17. echo $line >> $name
  18. done
  19. exit 0