Running your own Email Server with Multiple IPs using VirtualMin

At my company we regularly send out email marketing and emails for our vendors.  We needed a solution that could utilize multiple domains and multiple IPS.  We decided to host our email solution on a Linux VM using VirtualMin.  Here’s how to set up VirtualMin on your Linux VM and configure it to send out emails. I have included several scripts i have written and source code files to make the process easier. We will be using the domain YOURDAILYSOLICITATIONS for this example. All IPS are fictional. 100.0.0.1 corresponds to the ip address of your Linux VM.  You will also use the Linux VM as your NameServer with your Registrar. I personally prefer Name.com.

Using Putty or your favorite tool to SSH run the following command in your virtual Machine:

wget http://software.virtualmin.com/gpl/scripts/install.sh
sudo sh install.sh

Choose Y when prompted and let the install run. Go to the website https://100.0.0.1:10000. Login with your Linux VM root login and password. You’ll have a Wizard to configure VirtualMin. Choose the defaults of all screens except two of them. One will ask you to install mysql. Choose No. The other will ask for the initial domain you wish to utilize. You will check Skip Check for Resolvability. I’ve included the screens of the wizard that you need to change.

Click on WebMin, Servers, Postfix Mail Server, Edit Config files. Add the following lines to your main.cf file at the bottom

sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
header_checks = regexp:/etc/postfix/header_checks 

then run the following commands first to allow multiple ips and secondly to add /etc/postfix/header_checks

touch /etc/postfix/dependent
postmap hash:/etc/postfix/dependent]

I used VI to add /etc/postfix/headerchecks with the following lines

/^Received:/    IGNORE
 /^User-Agent:/  IGNORE
 /^X-Mailer:/    IGNORE
 /^X-MimeOLE:/   IGNORE
 /^X-MSMail-Priority:/   IGNORE
 /^X-Spam-Status:/   IGNORE
 /^X-Spam-Level:/    IGNORE
 /^X-Sanitizer:/     IGNORE
 /^X-Originating-IP:/    IGNORE
/^X-PHP-Originating-Script:/    IGNORE

then reload postfix

postfix reload

We’re going to add our domain via the command to create a domain within VirtualMin. This is the primary domain that also serves as the dns.

virtualmin create-domain --domain yourdailysolicitations.com --pass PASSWORD --desc "primary domain" --ip 100.0.0.1 --dns-ip 100.0.0.1 --unix --dir --webmin --web --dns --mail --limits-from-plan --ip-already
virtualmin modify-mail --domain yourdailysolicitations.com --outgoing-ip

And additional domains can be added with these commands

virtualmin create-domain --domain ANOTHERDOMAIN.COM --pass PASSWORD --desc "primary domain" --ip 100.0.0.2  --unix --dir --webmin --web --dns --mail --limits-from-plan --ip-already
virtualmin modify-mail --domain ANOTHERDOMAIN.COM --outgoing-ip

Now let’s add email users to our domain.

virtualmin create-user --domain yourdailysolicitations.com --user YOURUSER --pass PASSWORD --real "YOUR USER"
virtualmin modify-user --domain yourdailysolicitations.com --user YOURUSER --no-local
virtualmin modify-user --domain yourdailysolicitations.com --user YOURUSER --no-check-spam

Simply change the domain for each domain’s email accounts you want to set up.
You can access this account via Pop using incoming pop server as yourdailysolicitations.com. The username is YOURUSER.yourdailysoliciations and the password is PASSWORD. POP3 port will be 110
The default settings in Outlook work fine for IMAP and POP.

Leave a Reply

Your email address will not be published. Required fields are marked *