I've setup a VPS server with multiple domains all pointing to the same server.
The multiple domains are:
www.maindomain.com
www.seconddomain.com
etc.
For the main domain i've disabled the mail server because for the domain maindomain.com
I use Office 365. In regards to the mail settings I've setup the dns for maindomain.com
as following:
@ A 'IP address'
@ MX 0 maindomain-com01c.mail.protection.outlook.com.
mail CNAME @
For the domain maindomain.com
i've purchased a wildcard SSL certificate that i've installed (and assigned to the domain maindomain.com
) and have installed for the mail server (Postfix) and the IMAP server (Dovecot).
What I would like to achieveve is that on the client side the server settings for both the incoming and outcoming mail is: 'mail.maindomain.com' so I only have to buy one SSL certificate for my mail server instead of individual SSL certificates for every single domain.
The second domain: www.seconddomain.com
has the following mail DNS settings:
@ A 'IP address'
@ MX 10 mail.maindomain.com
I'm having doubts if this is the correct approach since www.maindomain.com
only has an MX record for the Office365 settings. Is it then still possible to point all the other domains to mail.maindomain.com
as mail server because i've disabled the mail server for www.maindomain.com
UPDATE 14-07
Thank you for all your answers. However I still have a problem to get this setup to work with my DNS settings.
With the following settings everything works fine (without SSL):
maindomain.com
DNS settings
@ 5 min A 37.97.193.145
@ 5 min MX 0 maindomain-nl01c.mail.protection.outlook.com.
@ 5 min TXT v=spf1 include:spf.protection.outlook.com –all
server1 5 min CNAME @
seconddomain.com
DNS settings
@ 5 min A 37.97.193.145
@ 5 min MX 10 mail
@ 5 min TXT v=spf1 a mx ip4:37.97.193.145 –all
server1 5 min CNAME @
So this is the DNS setup I use currently which works perfect. I can send mail to both Hotmail and Google e-mail adresses and can receive mail. Mailserver in Plesk is disabled for maindomain.com
and activated for seconddomain.com. In Outlook I use server1.seconddomain.com
as mailserver.
The DNS setup below I want to use so server1.maindomain.com
is used as mailserver for seconddomain.com
:
maindomain.com
DNS settings
@ 5 min A 37.97.193.145
@ 5 min MX 0 maindomain-nl01c.mail.protection.outlook.com.
@ 5 min TXT v=spf1 include:spf.protection.outlook.com –all
server1 5 min CNAME @
seconddomain.com
DNS settings
@ 5 min A 37.97.193.145
@ 5 min MX 10 server1.maindomain.com.
@ 5 min TXT v=spf1 a mx ip4:37.97.193.145 –all
server1 5 min CNAME @
With this setup I still have the mailserver deactivated for maindomain.com
(because I use Office 365 for maindomain.com
) and have the mail server activated for seconddomain.com
. In Outlook I use server1.maindomain.com
as mailserver.
Mail send from Outlook with server1.seconddomain.com
with the above setup is received as spam in both Hotmail and Gmail (without SSL active).
I also run some diagnostics on MX toolbox and with this setup it is saying that Google is the mailserver for server1.maindomain.com
. I don’t get any other errors (relay server is also server1, which is also the name of the server). Testing with mail-tester.com everything comes out fine also. As well as testing if the SSL certifcate is working correctly and pointing to the right mailserver.
I think the problem is that seconddomain.com
is referring to the mailserver of maindomain.com (it needs to because in the future I want to use the SSL certificate from maindomain.com
) but then it is sending e-mail with Outlook. Is that correct? And if so how can I correct this?
UPDATE 19-07
As stated below I changed the MX record to the domain name instead of the cname of the main domain:
@ 5 min MX 10 maindomain.com.
The weird thing is that did still doesn't fix the problem. However I did find out that not every gmail address receives the mail as spam. I did the following send tests:
info@[workdomain].nl Received test mail as spam
jarno@[workdomain].nl Received test mail in inbox
[personal]@gmail.com Received test mail as spam
I edited out some information because of privacy. All domains are hosted by Google apps. So the weird thing is that 2 e-mails for the same domain (stated as [workdomain]) receive the e-mail differently. One receives the mail as spam and the other one in the inbox.
I also tested the 'spamminess' of my mails with the online mail-tester tool. See the link below for a report: