I'm looking for a SMTP server that will just be used to forward a few email addresses. Two requirements:
- Easy to install and configure on Ubuntu.
- Has an aliases file that is easy to automatically add to. Ideally, it would be a text file consisting of rows like "foo@myserver.com mrfoo@gmail.com".
- (Ideally) Can be easily configured to only accept mail from specific hosts.
I've been trying Postfix, but I'm getting bogged down in error messages like Recipient address rejected: User unknown in virtual alias table
and Recipient address rejected: User unknown in local recipient table
. So I wonder if there is an easier solution.
Best Answer
Use Postfix
On ubuntu, do following
I am doing the exact same thing with my vps email setup. check up my blog post Tiny VPS Postfix. I am copying the example below
/etc/postfix/main.cf
Remeber to change
<YOUR HOSTNAME>
and<YOUR DOMAIN NAME>
Alias file
Your
/etc/aliases
file should be like the followingThe left hand side should have no domain name, only username. The domain is control by your postfix configuration. then do following
Single host restriction
To allow only email from a single(or a few) host, I am going to use a very lazy way to do it.
Assuming the IP of the allowed incoming host has IP 192.168.1.100, add it to
mynetworks
Change
smtpd_recipient_restrictions
to followingPostfix only (and always) accept email from host(s) listed in
mynetworks
. And reject everything else.DNS Configuration
Remember to setup MX record and spf record.