# MX record necessary?

## SanitysEj

ok, I wanna setup a webmail server.  I understand what the tutorial http://www.gentoo.org/doc/en/virt-mail-howto.xml has to say about it and can follow it ok.

What I need to know is:

 regarding the MX records, I have a fully qualified domain name (www.madkingdom.com) however, I don't believe I have an MX record with it.  When setting up my mail server do I have to have an MX record?  Or, can I just use my domain name and be ok.  If I have to have one, can I set it up in my own DNS server, or will I have to purchase one?

Please help alleviate my confusion, and, as always.......THANX

----------

## mglauche

usually the MX record should be set up for non-ip reachable systems. i.e. if you want to recieve mail form user@madkingdom.com, but madkingdom.com has no IP adress. Then with the MX records the MTA will look up the mailhost for that domain.

MX is also very important for email delivering email if your host is down, as you can specifiy backup email hosts.

try: nslookup -

> set type=mx

> yourdomainname.com

----------

## SanitysEj

So, if I understand correctly, for right now, since www.madkingdom.com is being forwarded to 68.86.49.121 (my wan ip address from comcast for cable modem) then internally routed to 192.168.2.39 (the box currently hosting server and "madkingdom"), that means I actually have an IP address for Madkingdom.com and don't need an MXrecord unless I want to setup backup email servers, correct?

If this is the case, which IP gets specified for my email server host, the WAN ip or the ip of the email server?

Thanx again.

----------

## ragger

There exists an MX record for the madkingdom.com domain and it currently points to smtp.madkingdom.com which is a non-existing host.

So you just need to ask the people that run the DNS for you to add this smtp.madkingdom.com and let it point to the external ip (not the ip used on internal net)

of the box running the mailserver (keep in mind that you need to have a static ip).

If the smtp.madkingdom.com server is setup you can use user@madkingdom.com addresses.

Currently the www.madkingdom.com address points to an ip owned by godaddy and it only forwards http traffic to your cable ip. So using user@www.madkingdom.com addresses is currently not possible (unless godaddy also does mail forwarding for you, but i doubt it)

----------

## SanitysEj

Well, thank you both for your input.  It's cleared up some stuff for me.  I've got one more thought regarding the statement  *Quote:*   

> (keep in mind that you need to have a static ip). 

  from ragger.

I have a dynamically assigned ip from comcast, however, it's only changed 3 times in about 7 months, so, I can deal w/ that.  I just adjust my name forwarding for www.madkingdom.com to point to the proper ip.  I am of the mind there has to be some kind of workaround for my mailserver here too.  I have a dns server on my internal domain, can I somehow setup the MX record on that?  

Forgive the naivete, just new to mailservers.

Any comments on this?  Please? 

Thanx again.

----------

## sieter

Well, no you cannot set up the MX on your internal DNS.

A foreign mailserver uses a different DNS server that does not have

the MX entry, so it doesn´t know about your mailer.

But don´t worry ´bout changing IP´s,

mine is changing every 24 hours...

Though I have a backup mailer with a fix ip, almost every mail is delivered directly...

----------

## kashani

 *SanitysEj wrote:*   

> ok, I wanna setup a webmail server.  I understand what the tutorial http://www.gentoo.org/doc/en/virt-mail-howto.xml has to say about it and can follow it ok.
> 
> What I need to know is:
> 
>  regarding the MX records, I have a fully qualified domain name (www.madkingdom.com) however, I don't believe I have an MX record with it.  When setting up my mail server do I have to have an MX record?  Or, can I just use my domain name and be ok.  If I have to have one, can I set it up in my own DNS server, or will I have to purchase one?
> ...

 

If your FQDN is where you want your mail to be deleivered, you don't need an additional MX statement. 

example:

If an A record exists for www.badapple.net, mail servers will attempt to deliever mail there, but:

If no MX records exist for badapple.net *@badapple.net will be deleiverable.

If you'd like mail for www.badapple.net and *@badapple.net to go to mail.badapple.net you will need to set an MX record for both the domain and the host.

Hope that clears things up. BTW my latests screwup involved thinking that wildcard MX records work... they do not IF there is an existing A record for the host. It will always take precedence in the way DNS does matching within your zone file. 

kashani

----------

## digitalnick

a clinet of mine was having the same problem understanding a very similar issue

he had forwarding on from godaddy to his comcast ip he couldnt figure out why the websites werent working.

here is an easy fix

goto godaddy

turn off forwarding

goto dyndns.org

register and account

pay 30 bux for a dns entry (one time fee .. not recurring)

setup your domain there

go back to godaddy

goto namservers and put in the 5 nameservers dyndns gives you

now you have a dynamic ip right

so get a dyndns client you can emerge dyndnsupdate

set it up in cron to check yoru account and update you dns entry ifyour ip changes

now you have dns pointing at your box and it gets updated automattically in case your ip changes again

there are a few other settings that deal with your mailserver and host ect ... but thats basically what you need to do to be able to accept mail at user@domain.com  :Wink: 

----------

## SanitysEj

Well, thank you ALL for your help.  Between all the advice, I think I've got it figured out.  Since my FQDN provider says "you currently have no MX record set" and kashani said "If no MX records exist for badapple.net *@badapple.net will be deleiverable.", I believe I'll be ok.  

If anyone disagrees, please let me know before I get stuck.

Thanx much for all the help

----------

## kashani

 *SanitysEj wrote:*   

> Well, thank you ALL for your help.  Between all the advice, I think I've got it figured out.  Since my FQDN provider says "you currently have no MX record set" and kashani said "If no MX records exist for badapple.net *@badapple.net will be deleiverable.", I believe I'll be ok.  
> 
> If anyone disagrees, please let me know before I get stuck.
> 
> Thanx much for all the help

 

Except Kashani's favorite thing to do is leave out the NOT when he's in a hurry. 

You need an MX for *@domain.com to work, but a FQDN gets mail because it has an A record. Sorry about that.

kashani

----------

## SanitysEj

OK, so, here's the lowdown.  My plan up for critique.  Please let me know if it will work. I think it should.  Before I go on, I do understand using IP's isn't a mail standard, so, some mail may not be deliverable, however, it's also my understanding (correct me if I'm wrong) that typically it works fine.  

I've set my MX record to my external WAN IP *68.86.49.121* I then have a virtual server routing all traffic on ports 110 and 25 to/from my mailserver host box's IP on my private net *192.168.2.100*. 

This way, I should be able to send and recieve mail from *@madkingdom.com, correct?  Also, is there anything I'm missing that's not covered in the above mentioned tutorial?   

Thanx Again.

BTW - I am going to look into dyndns, but, for right now, even $30 doesn't fit into the budget   :Confused: 

----------

