HOWTO: Basic postfix setup for Fedora on Slicehost
Quick & dirty instructions for setting up postfix to send email from your slice.
Please note: this is a draft version, if you think anything should be changed please leave a comment.
Quick & dirty instructions for setting up postfix to send email from your slice.
Note: These instructions are for setting up postfix to send email from the local machine only (from a web app on your machine, for example), if you want to setup a full email service (send from remote machines, receiving mail, etc.) you probably should checkout the email HOWTOs at HowtoForge.
Most commands will need to be run as root, so you’ll need to run su first, or add sudo before them (if you have sudo installed)
Install postfix:
yum install postfix
You might want to install the telnet client for testing purposes if you haven’t already:
yum install telnet
Edit /etc/postfix/main.cf and change/uncomment the following:
mydomain = example.com myorigin = $mydomain inet_interfaces = localhost mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mynetworks_style = host
Where ‘example.com’ is your domain name
Start postfix:
/sbin/service postfix start
Time to test!
telnet localhost 25
You should see the following:
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 yourdomain.tld ESMTP Postfix
Type the following commands (don’t forget to change the domain/email addresses!)
EHLO yourdomain.tld MAIL FROM: <you@yourdomain.tld> RCPT TO: <anotheremail@anotherdomain.tld> DATA To: anotheremail@anotherdomain.tld Subject: postfix test w00t! postfix works :) . QUIT
You should now have a test email waiting at the other email address you specified.
Try telnetting to port 25 of your domain from a remote host, you should get a ‘connection refused’ message. If you don’t, you’ve just setup an open mail relay (that’s a bad thing). You might want to stop the server:
/sbin/service postfix start
and go over the instructions again, paying particular attention to the ‘inet_interfaces = localhost’ line in your config.
If all is well, then setup postfix to run on startup:
/sbin/chkconfig postfix on