Skip to content

Instantly share code, notes, and snippets.

@briandemant
Forked from xianhuazhou/gist:1415626
Last active September 5, 2016 07:59
Show Gist options
  • Save briandemant/55053becdf28f9759499682fc6172614 to your computer and use it in GitHub Desktop.
Save briandemant/55053becdf28f9759499682fc6172614 to your computer and use it in GitHub Desktop.
a fake sendmail script for testing mail related applications, can replace /usr/sbin/sendmail
#!/bin/sh
# Source : https://github.com/Sanchiz/fake_sendmail.sh
prefix="/home/USERNAME/sendmail/new"
numPath="/home/USERNAME/sendmail"
if [ ! -f $numPath/email_numbers ]; then
echo "0" > $numPath/email_numbers
fi
emailNumbers=`cat $numPath/emailNumbers`
emailNumbers=$(($emailNumbers + 1))
echo $emailNumbers > $numPath/emailNumbers
name="$prefix/letter_$emailNumbers.eml"
while IFS= read line; do
echo "$line" >> $name
done
chmod 777 $name
/bin/true
#!/bin/sh
# chmod 666 /var/mails.txt
# all mails will be stored in this file
MAILS_FILE='/var/mails.txt'
while read x
do
echo $x >> $MAILS_FILE
done
echo "----------------------" >> $MAILS_FILE
echo >> $MAILS_FILE
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment