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 edinson@viajando.com and do not leave edinson@mail.viajando.com 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.
@egutierrez9615
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.
https://mailcow.email
https://github.com/andryyy/mailcow#before-you-begin-prerequisites
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.
*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 nameserver 8.8.8.8 nameserver 8.8.4.4
*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 main.cf:
myhostname = mail.DOMAIN.TDL alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = DOMAIN.TDL <---------------------------------//// ?? I think this is problem ?? mydestination = mail.DOMAIN.TDL #relay_domains = relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_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