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 "[email protected] [email protected]".
- (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.
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.
I use Postfix in a similar fashion to forward to another server. Using the three configuration options, but for your config there is an easier way.
One of my LDAP files looks like this for querying an LDAP source on Zimbra...
However, based on what you are looking for, it would be easier to keep the information in local hash tables that can be used for this purpose. The only thing you need to remember is that when you make changes to the files, you need to re-run postmap to build the postfix friendly hash table.
You will need to create a text file in the above location with the following entry pairs: {[email address] OK}
Run postmap on the file above to generate the actual hash file which is then created in the same folder as relay_recipients_maps.db. Postfix will now check this file for valid recipients for delivery.
You then need to tell Postfix where to send email for this domain when it is received. Doing the same thing with /etc/postfix/transport_maps file, you can enter vaild pairs which are the domain the email is going to and the host to forward it on to.
Hopefully this helps point you the right direction. There is alot more information on how to do these types of config files on the internet and others can even use DB's for lookups for these configuations options.