I have a VPS server that only deals with email hosting. This server does not have any designated domain name pointing to it. Its only one VPS with one IP address.

I am running CentOS 6.5 Minimal, 32bit with Postfix and Dovecot installed. This is currently what my etc/postfix/main.cf looks like (for domain/hosting attributes).

# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
myhostname =   
#myhostname =

# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
mydomain =     
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites.  If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#myorigin = $myhostname
myorigin = $mydomain

As you might have noticed, both myhostname & mydomain fields are empty. The reason for this is, the server doesn't really have a domain or hostname. What should I be doing in this case?

I have an M record pointing to mail.my-domain.tld and MX record pointing to mail.my-domain.tld

Can I use mail.my-domain.tld for both as mydomain = and myhostname = in main.cf? Because my-domain.tld is pointing to another VPS with another IP, which takes care of only web hosting.


By default your mail server should accept email sent to its hostname, in your mydestination parameter you enter what domains you are receiving email for, so that would be my-domain.tld in your example and you can set myhostname, mydomain to one of the domains.

This is independent of your MX record, that record (which can be anything) points to a domain name which should resolve to the IP of your server (A record), you probably don't need to change it.

  • Thanks, but what if I have over 10 domains, for which I am using this server to host all their emails? Can I put all those domains in mydomain & myhostname filed? – samayo Apr 22 '14 at 18:28
  • Sorry, mixed up mydomain and mydestination, edited the answer. So yes, you can put many mydestination domains separated my commas – LinuxDevOps Apr 22 '14 at 18:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.