SOLVED Remote mail servers ips

wonder_wonder

Well-Known Member
Jan 16, 2019
100
35
28
Spain
cPanel Access Level
Root Administrator
Hello.
I have 2 VPS, one for website server, and other for use for mail server.
My website server is a page that, send email to users (notifications, subscriptions...) I view this option in WHM and this is new for my and I'm newbie in this aspects (two servers for to services).
I don't want that, when my web send mail to users, in header mail, appears the ip of my server (the 2 VPS have differents ips) for this reasson now, I have 2 VPS for separate this two servers.
Its possible configure this in this part of WHM o how I can configure my webserver for connect to mail server and send mail with my my domain?

Sorry if I don't explained very well...

Thanks and regards!
 

kodeslogic

Well-Known Member
Apr 26, 2020
187
57
103
IN
cPanel Access Level
Root Administrator
The below steps will help you to route emails from new (mail) server

  1. Create an account with the same domain on the new (mail) server.
  2. Now on the webserver point the MX record to IP address of the mail server.
  3. On webserver Configure Email Routing in cPanel (This need to be done on web server only)
    • Login to cPanel and navigate to the “Mail” section.
    • Click on the “Email Routing” icon to open the page.
    • Select the desired domain from the menu. If only one domain exists on your cPanel account, the system selects it automatically.
    • Set Configure Email Routing to Remote Mail Exchanger
 
  • Like
Reactions: wonder_wonder

wonder_wonder

Well-Known Member
Jan 16, 2019
100
35
28
Spain
cPanel Access Level
Root Administrator
Hello.
At the first time, thank you for your reply.
I made the changes but I have some problems/doubts;

Point 1, ok.
Now on the webserver point the MX record to IP address of the mail server.
I can't, I go to WHM-DNS Functions-Edit MX Entry, and here, appears my domain. In the two VPS I use the same domain, I can't point to IP address of the mail server, indicate a message error: Invalid DNS record: IP addresses are not allowable exchange values.
On webserver Configure Email Routing in cPanel (This need to be done on web server only)
  • Login to cPanel and navigate to the “Mail” section.
  • Click on the “Email Routing” icon to open the page.
  • Select the desired domain from the menu. If only one domain exists on your cPanel account, the system selects it automatically.
  • Set Configure Email Routing to Remote Mail Exchanger
This is ok (but I configured this first in WHM and then, in cPanel, I view this change made).

Also, I don't know if in Edit DNS Zone (in WHM), select my domain (this is in webserver) and I need change the MX record and CNAME record for mail, also, I try but the same error that in point 2, I can't.

Thank you very much for your help and attention!
 

kodeslogic

Well-Known Member
Apr 26, 2020
187
57
103
IN
cPanel Access Level
Root Administrator
On the web server

  1. Create an A record (eg "mx") which points to a new server (mail server).
  2. Update existing MX record entry from "your-domain.com" to "mx.your-domain.com" (without double quotes).
 
  • Like
Reactions: wonder_wonder

wonder_wonder

Well-Known Member
Jan 16, 2019
100
35
28
Spain
cPanel Access Level
Root Administrator
On the web server

  1. Create an A record (eg "mx") which points to a new server (mail server).
  2. Update existing MX record entry from "your-domain.com" to "mx.your-domain.com" (without double quotes).
Thanks a lot for this detailed indications.
Yes, now I can edit this.
Only a tip :)
Old VPS is for mail server, new VPS is for webserver, but not problem, I know to made your detailed indications.
Ok, I made this change, but one or last doubt (sorry for this...).
In my webserver VPS, in DNS zone, I have some entries like this:
mail (CNAME).
I need change or edit?

Again, thank you very much!
 

kodeslogic

Well-Known Member
Apr 26, 2020
187
57
103
IN
cPanel Access Level
Root Administrator
You can update the CNAME record from "your-domain.com" to "mx.your-domain.com" (without double quotes) this will add Canonical Name mail.your-domain.com for new MX record mx.your-domain.com

Note: These changes are to be done on the server on which your current nameservers are pointing. I assume it is a web server in your case.
If you use any CDN (eg "Cloudflare") then MX records need to be updated in the CDN dashboard as well.
 
Last edited:
  • Like
Reactions: wonder_wonder

wonder_wonder

Well-Known Member
Jan 16, 2019
100
35
28
Spain
cPanel Access Level
Root Administrator
Thank you, you cannot imagine how I appreciate your help ... I have been 2 or 3 days, you could say that, desperate.
Ok, as you say, these changes are in the webserver, indeed, I just updated the cname as you indicated.
And right, I use Cloudflare, and here I get lost more ...
The MX record on Cloudflare, should I update it to: mx.my-domain.com?
I was thinking that, I had to create an A record with mail.my-domain.com pointing to the ip of the mail server, and the mx record pointing to mail-my-domain.com
But this doesn't work unless you leave the mail.my-domain.com record gray
I really don't know how to configure the mx record on cloudflare now.

I would like to configure everything correctly in my VPS (even if I use cloudflare) but that way I make sure everything is correct and I learn.
Currently, and according to your indications, I have these records:

my-domain.com. 14400 IN MX 0 mx.my-domain.com.
mail 14400 IN CNAME mx.my-domain.com.
mx 14400 IN A (ip of mail server VPS)

This is correct?

Again thank you very much, honestly, you can't imagine how much I appreciate your help.
 

kodeslogic

Well-Known Member
Apr 26, 2020
187
57
103
IN
cPanel Access Level
Root Administrator
You have to make sure the below records exist at Cloudflare as well

my-domain.com. 14400 IN MX 0 mx.my-domain.com. ( DNS only )
mail 14400 IN CNAME mx.my-domain.com. ( DNS only )
mx 14400 IN A (ip of mail server VPS) ( DNS only )

 
Last edited:
  • Like
Reactions: wonder_wonder

wonder_wonder

Well-Known Member
Jan 16, 2019
100
35
28
Spain
cPanel Access Level
Root Administrator
Ok, I have made the changes and now it responds to the ping (ping mail.my-domain.com or ping mx.my-domain.com) with the ip of my VPS mail server.
I have a couple of questions:
1.-Now, all the notifications mails (whether of updates, firewall ... etc ...) from my VPS webserver, are they sent through the VPS mail server? (I ask this because, at the moment I have deactivated the VPS mail server until I have everything correctly configured and I am not receiving any mail and it surprises me because with the changes I make I think I should have received some mail).
2.- I see that in WHM-Server Configuration-Server Profile, we can establish our server as Mail Node, is it advisable to configure it like this on the VPS mail server?
3.- Should I leave all the dns records like mx and others exactly the same as before in my VPS mail server? Before this server was for everything, web and mail.

Again, you can't imagine how much I appreciate your help.
 

kodeslogic

Well-Known Member
Apr 26, 2020
187
57
103
IN
cPanel Access Level
Root Administrator
  1. Yes, all emails will be handled by your mail server.
  2. Please check - How to Use Server Profiles
  3. You may leave the DNS records on your server as it is, as you are using Cloudflare which should be correctly configured as discussed in previous replies.
If still any confusion you can ping me over skype.
 
  • Like
Reactions: wonder_wonder

wonder_wonder

Well-Known Member
Jan 16, 2019
100
35
28
Spain
cPanel Access Level
Root Administrator
  1. Yes, all emails will be handled by your mail server.
I supuse this...in this case, its possible configure for VPS mail server send me the mail notifications? For if I have some problem in one of the two servers, can know what server send me the email.
Like I have configured in cloudflare the entries for use my mail in VPS mail server, if reconfigure my webserver to local mode (about mail) in other words, not configure for Remote email Exhanger, is good or bad iddea? Sorry for this questions, I feel like a newbie...
Perfect, thanks!
You may leave the DNS records on your server as it is, as you are using Cloudflare which should be correctly configured as discussed in previous replies.
Perfect!
If still any confusion you can ping me over skype.
You do not know how I thank you ... thank you very much!
 
Last edited: