Skip to content

Instantly share code, notes, and snippets.

@tknr
Last active May 16, 2018 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tknr/17832c3a0813c9e7f0d9b1a0d7a28eb2 to your computer and use it in GitHub Desktop.
Save tknr/17832c3a0813c9e7f0d9b1a0d7a28eb2 to your computer and use it in GitHub Desktop.
#!/bin/bash -x
echo "this command must be executed in root user."
if [ ${EUID:-${UID}} != 0 ]; then
echo 'do this with being root . for example : sudo su - '
exit 1;
fi
## install maildev
yum -y install nodejs npm postfix
npm install -g maildev
npm install -g iconv
## daemonize maildev
wget "https://gist.githubusercontent.com/tknr/aebf61f161ae06c3d71e8d22bd6c788c/raw/7cb702a20cd0e9f554826e8fe6467d2058d5e51a/maildev"
chmod +x maildev
mv maildev /etc/init.d/
systemctl enable maildev
systemctl restart maildev
systemctl status maildev
## add php setting
echo -e "[mail function]\nSMTP = localhost\nsmtp_port = 1025" > /etc/php.d/maildev.ini
## add postfix setting
cp /etc/postfix/{main.cf,main.cf.org}
echo "relayhost = 127.0.0.1:1025" >> /etc/postfix/main.cf
systemctl enable postfix
systemctl restart postfix
systemctl status postfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment