Skip to content

Instantly share code, notes, and snippets.

@tknr tknr/install_maildev.sh
Last active May 16, 2018

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.