I cant understand what I need for hostname / hosts for email server

For an iredmail server. What should I name my droplet or What should then be the entry in ect/hosts? It says all kinds of different things all over the internet /etc/hosts. I think all the questions I have posted actually are due to the fact I can’t figure this out.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

How dose this look? <br> <br>$TTL 1800 <br>@ IN SOA ( <br> 1398242919 ; last update: 2014-04-23 08:48:39 UTC <br> 3600 ; refresh <br> 900 ; retry <br> 1209600 ; expire <br> 1800 ; ttl <br> ) <br> IN NS <br> NS <br> NS <br> MX 0 <br>@ TXT “v=spf1 ip4:IP_ADDRESS -all” <br>dkim_domainkey TXT “v=DKIM1; p=” “MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBi…” #left out most <br> IN A <br> IN A <br> <br>/etc/hostname <br> <br> <br>/etc/hosts <br> localhost localhost.localdomain <br> <br>$hostname -f <br> <br> <br>xxx not actual values!

nice thanks

You can give your droplet either name, and you shouldn’t need to edit /etc/hosts. You just need to create a DNS A record for any subdomain to which you might want to point an MX record. (Yes, a CNAME will work, but technically, according to the RFC, it’s supposed to resolve to an IP address.) <br>I’ll give you a concrete example. <br>Just for purposes of managing my various servers (I run one for mail and one for nginx), I registered the domain The first droplet I created, I called That is the FQDN that gets used for dovecot and postfix. If I wanted to stop there, I could. I could point any MX records to and that would be fine. My mail users could use as their incoming and outgoing server addresses. (I actually could have stopped one step earlier with, but didn’t because I was going to be managing multiple hosts under that single domain.) <br>I am hosting mail for three different domains on They are all coming from a previous shared hosting environment where their incoming and outgoing servers were addressed as “mail.” subdomains of their primary domain. One of those domains is, so our mail servers were Likewise for the other two domains. I pointed the MX record to, and the A record to the IP address for, and similarly for the other two domains. The user names and passwords were all the same as the server they were being moved from, so when the changeover happened, the only thing anyone noticed was the SSL certificate name mismatch because I was using a self-signed certificate. <br>All of that was done entirely with DNS - no alteration of /etc/hosts. <br>Although using a mail. subdomain for each domain was convenient to the users because it didn’t require them to change anything when the service moved, it does complicate things on my end somewhat when it comes to SSL. I can get a signed SSL certificate for my mail server, but to the best of my knowledge, it can use only one name. Dovecot will allow for different server names, but it looks to me like they must resolve to different IP addresses, and multiple IP addresses on a single instance is not something you can get with Digital Ocean. So either you can use a single domain for all users, secured by SSL, or you can use multiple mail. subdomains, also secured by SSL, but users will end up with name mismatch warnings.