Skip to content

Instantly share code, notes, and snippets.

@slivorezka
Created August 15, 2018 08:25
Show Gist options
  • Save slivorezka/1d0f5107f4e653237f43a454b7712840 to your computer and use it in GitHub Desktop.
Save slivorezka/1d0f5107f4e653237f43a454b7712840 to your computer and use it in GitHub Desktop.
PHP Stopper for testing email notification in the localhost
Step #1
Cretae file in the next path /usr/bin/localhost_sendmail
Step #2
Add to the new file this below content:
#!/bin/sh
prefix="/var/mail/sendmail"
date=$(date +'%F %H:%M:%S')
name="$prefix/$date.eml"
while read line
do
echo $line >> $name
done
chmod 666 $name
Step #3
Make this file executable: sudo chmod +x /usr/bin/localhost_sendmail
Step #4
Cretae folder: sudo mkdir /var/mail/sendmail
Step #5
In the php.ini file (to get this file run any php script with "echo php_ini_loaded_file();")
Find line sendmail_path and replace it for sendmail_path = /usr/bin/localhost_sendmail
Step #6
Restart or reload PHP server
Step #7
Try sent an email in you localhost and check folder /var/mail/sendmail
That's all!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment