4

I have 5 domain names currently pointing to my email server, which is running CentOS 6.5 with Postfix, Dovecot installed. Although I am now only able to receive emails but not send (for reasons I can't understand) I am having trouble configuring this part of the main.cf as there seems to be a place for only one domain name and host to be specified.

# The default_privs parameter specifies the default rights used by     
# the local delivery agent for delivery to external file or command.   
# These rights are used in the absence of a recipient user context.    
# DO NOT SPECIFY A PRIVILEGED USER OR THE POSTFIX OWNER.               
#                                                                      
#default_privs = nobody                                                

# INTERNET HOST AND DOMAIN NAMES                                       
#                                                                      
# 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 = mail.domain1.tld
#myhostname = virtual.domain.tld                                       

# 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 = mail.domain1.tld

Here I am forced to mention mail.domain1.tld while in fact, I have 4 other domains. And the second confusing thing is that, since domain.tld is pointing to another web host VPS, I am only pointing mail.domain1.tld to this email host. So, I am sure mydomain = domain1.tld would make no sense.

So, I guess my point is, what value do I give to this attribute, it I am hosting emails for more than one domain?

5
  • 1
    mydomain isn't mail.domain1.tld but rather domain1.tld. What is your mydestination set to? – GeneBean Apr 20 '14 at 15:21
  • @GeneBean But domain.tld points to another A record, or another VPS. Plus, here is mydestination line mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain – samayo Apr 20 '14 at 15:28
  • 1
    That makes no difference. You are not setting an A record, you are saying where your mail is coming from... aka mydomain matches whats after the @ – GeneBean Apr 20 '14 at 16:18
  • @GeneBean Ok, forgive the noobness in me talking, but let me get it clear this time. You are saying, even if I am hosting an email for 100+ domains, it will be enough to mention just one of them as mydomain = & myhostname = ?? And in this case, I have no hostname. I only have domain names. The hosting for these emails is done in a VPS that is only identified by its IP. – samayo Apr 20 '14 at 16:25
  • 1
    I really think you need to pause and read library.linode.com/mailserver as it will give you the information needed to do this right. You can also find lots of hints that my help at postfix.org/documentation.html Reading that Linode guide will be faster & more productive than working through the multiple Q's you've posted here. – GeneBean Apr 20 '14 at 16:34
5

myhostname and mydomain are just default values used for various purposes. For example,

  • message-IDs are of the form something@myhostname,
  • during the SMTP HELO/EHLO phase, the server identifies itself as myhostname,
  • when a mail is sent to someone@somewhereWithoutADot, mydomain is added automatically,
  • etc.

For a detailed list, man 5 postconf and search for myhostname and mydomain.

Thus, if you have a main domain that your mail server is responsible for, choose that. If you don't, choose any of the domains. Note that your system already has a main hostname: check the output of the commands hostname and hostname --fqdn.

It does not matter that the A record of domain1.tld points somewhere else. The important thing is that myhostname resolves to the IP address of your mail server; otherwise, other mail servers will eye you with suspicion and spam filters are more likely to dislike your mails.

For mydomain I would use the following rule of thumb: Check the output of the command hostname. If a mail is sent to someone@outputOfHostname, what domain should be appended to make it reach your system?

11
  • Ok, I found something surprising. hostname --fqdn gives me myname.cloud.vps_provider_name.com I guess it is using assigned name my provider gave me. Second thing is that, I don't have a domain responsible for that server, because all mydomains point to my web host (another VPS) so, this has nothing except the ID. But I don't understand what you meant The important thing is that myhostname resolves to the IP address of your mail server can you clarify it a bit pls ? thanks @Heinzi – samayo Apr 20 '14 at 16:13
  • Do you understand how DNS works? If yes, make sure that the A record of myhostname points to the IP address of your server (i.e., if you type host mail.domain1.tld you should get your own IP address). If not, you might want to read up on that... it's among those things that you "should know" when you are running your own mail server. – Heinzi Apr 20 '14 at 16:30
  • I am not getting my IP. Maybe you are right, but as far as I read on the subject, I understood enough to set up A and MX record A RECORD AND MX RECORD I don't see anything wrong with those. – samayo Apr 20 '14 at 16:34
  • And what did you set them to? – Heinzi Apr 20 '14 at 17:43
  • @Heinze You can see the images in my comment, in the link. I took screenshots for both – samayo Apr 20 '14 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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