How to configure sendmail/postfix to relay or forward emails via an SMTP server
- Uninstall sendmail
- Install postfix
yum install postfix
# or
apt-get install postfix
- Configure postfix
sudo vim /etc/postfix/main.cf
Add:
relayhost = smtp.devil.com
yum install postfix
# or
apt-get install postfix
sudo vim /etc/postfix/main.cf
Add:
relayhost = smtp.devil.com
Use the mail command...
mail -s "Yer subject" [email protected] -- -r "[email protected]"
echo -e "TEST\n.\n" | mail -s "subject" [email protected] -- -r "[email protected]"
Note that we use the -e switch to preserve new lines.
mail -s "subject" [email protected] -- -r "[email protected]" < /tmp/email