Web server and mail in different droplets

Posted February 8, 2017 2.8k views

Hello guys, I have a doubt that I have a headache.

I have my droplet A and my droplet B in my droplet A I have a web server and in droplet B I want to put the mail server.

In my droplet B I will use postfix to handle the mails but I want them to leave with the next user and do not leave
I have read that you have to modify the mx and txt of droplet B but I still do not know how they help me?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

*Droplet A host name should be: www

*Droplet B host name should be: mail

in your Registrar DNS under MX you need to add the hostname.domainname.tld of your webserver.

DNS should be corrected on the Mail host (Droplet Server itself) under /etc/resolv.conf

Here you need to add the DNS of your Provider.. but also easy to use Public Name servers as google. It should look like this:

Generated by NetworkManager

search domainname.tld

*Also your Host name doesn’t need to be specific to what that host will provide as I have a droplet running both Mail and WWW services… But the Host names must be correct in the hosts file.

It looks like all is working…

Here is an example of some of my

myhostname = mail.DOMAIN.TDL
aliasmaps = hash:/etc/aliases
database = hash:/etc/aliases
myorigin = DOMAIN.TDL <———————————//// ?? I think this is problem ??
mydestination = mail.DOMAIN.TDL

relay_domains =

relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailboxsizelimit = 0
recipientdelimiter = +
interfaces = all
inet_protocols = ipv4

You should comment out the first myorgin = /etc/mailname

Debian specific: Specifying a file name will cause the first

line of that file to be used as the name. The Debian default

is /etc/mailname.

I comment out my mailname because my

myorigin = /etc/mailname

My emails sent out as aliase@domain.tld


For the purpose of setting up a proper e-mail server, I would highly recommend using something that will auto-configure everything for you. It’ll be far less of a headache and easier to manage.

This will simplify things quite a bit and it’s what I recommend to others looking to do the same.

As far as DNS records for the mail server, what you specifically need to be concerned with is SPF and DKIM, though DMARC may also be required in the not too distance future.