How E-Mail Works...and other stuff
"Do you provide back up mail service?". The answer to this question is always no. The reason we do not provide this service is because it is not needed, and usually just causes trouble. I am going to explain a bit about how mail works from the machines point of view and then explain about the different ways to solve the problem, "What if my mail server goes down?" Lets start by tracking a piece of mail as it goes from sender to sendee. Joe Smith at AOL wants to send a e-mail message to Jane Smith at Broadview. Joe fires up his favorite e-mail client composes a fabulous e-mail and hits send, confidant that the message will magically appear on Jane's screen in a matter of seconds. What happens behind the scenes? After Joe hits the send button the e-mail client looks up the SMTP server it should using. For arguments sake lets say it is smtp.aol.com. Joes machine makes a connection to smtp.aol.com on port 25. smtp.aol.com looks at the IP address Joe is currently using and consults a configuration file to make sure the IP belongs to AOL. This step is important as it keeps people from connecting to AOL's SMTP server and sending out 100,000,000 messages about "How to beat the odds in Vegas for $5.99". AOL would have little defense and no way of tracking who sent them. Attempting to connect to, and send mail from any SMTP server is called relaying. You can try this by putting another ISPs SMTP server into your mail client and attempting to send a piece of mail. You will get a bounce that says " We do not relay", or other stern reminder that you are not welcome to send mail through that particular SMTP server. After the smtp server determines you are allowed to send, or relay, mail through it,it looks at the recipient. In this case it is jane@broadviewnet.net the smtp server then consults it's DNS server for the proper MX record. You can simulate this by typing the following at a command prompt on UNIX1, note the commands to type are followed by --------> you wouldn't actually type ---------->, but I am sure you knew that. -------> nslookup Default Server: ns1.broadviewnet.net Address: 64.115.0.9 -------> set q=mx -------> broadviewnet.net Server: ns1.broadviewnet.net Address: 64.115.0.9 Non-authoritative answer: broadviewnet.net preference = 0, mail exchanger = c.mx.broadviewnet.net broadviewnet.net preference = 0, mail exchanger = d.mx.broadviewnet.net broadviewnet.net preference = 0, mail exchanger = a.mx.broadviewnet.net broadviewnet.net preference = 0, mail exchanger = b.mx.broadviewnet.net Authoritative answers can be found from: broadviewnet.net nameserver = a.ns.broadviewnet.net broadviewnet.net nameserver = b.ns.broadviewnet.net a.mx.broadviewnet.net internet address = 64.115.0.12 b.mx.broadviewnet.net internet address = 64.115.0.13 c.mx.broadviewnet.net internet address = 64.115.0.14 d.mx.broadviewnet.net internet address = 64.115.0.15 a.ns.broadviewnet.net internet address = 64.115.0.40 b.ns.broadviewnet.net internet address = 64.115.0.41 We get the mail exchangers for Broadview as c.mx, d.mx, a.mx, and b.mx. The IP addresses are 64.115.0.12,12,14, and 15 respectively. Lets look more closely at the mx record lines broadviewnet.net preference = 0, mail exchanger = c.mx.broadviewnet.net The first part "broadviewnet.net" is the domain the MX record services no surprise there. The next part "preference = 0" is the priority of the servers. 0 is the first server is will try. Sometimes you will see this somedomain.net preference = 0, mail exchanger = maila.somedoamin.net somedomain.net preference = 10, mail exchanger = mailb.somedomain.net This said, try to send mail to maila.somedomain.net first, if it doesn't respond try mailb.somedomain.net. This way if maila.somedoamin.net is down or unreachable for some reason it will send it to mailb.somedoamin.net. Once AOL's smtp server makes a connection to a server it has a conversation with it to transfer the mail to the remote machine. Here is a step by step conversation in English to give you an idea of what happens. 1. smtp.aol.com Knock: Knock c.mx.broadviewnet.net AKA 64.115.0.14 port 25 2. c.mx.broadviewnet.net: Yes I am here, Who is it? 3. smtp.aol.com: Hello I am a server at AOL.com 4. c.mx.broadviewnet.net: Yes aol.com I will accept connections from you. 5. smtp.aol.com: I have some mail from joe@aol.com 6. c.mx.broadviewnet.net: Yes I will accept mail from joe@aol.com 7. smtp.aol.com: Thanks: I have a piece of mail that goes to jane@broadviewnet.net 8. c.mx.broadviewnet.net: Yes I am authorative for broadviewnet.net and I have a mailbox for jane. 9. c.mx.broadviewnet.net: Go ahead and send the message. 10. smtp.aol.com: Ok here it comes................ 11. c.mx.broadviewnet.net: Ok I got it. 12. smtp.broadviewnet.net: Good bye. 13. c.mx.broadviewnet.net : Good bye This is a simplified version of what happens of course. In step 4 the server would consult its configuration file to make sure is allowed to accept mail from AOL. And on step 8 it would consult it's configuration to be sure it is allowed to accept mail on behalf of Broadview. If it wasn't configured to accept mail on behalf of Broadview a error and a bounce will result with the following error. " Although I am a best MX preference This domain is not in my locals file so I don't treat it as local." I am sure everyone reading this has run into this error. This error occurs when DNS is set up with a MX pointing to Broadview's mail server, but the mail server is not configured to accept mail on the domains behalf. Now that you have a basic understanding of how mail is processed and handled between mail servers on the internet, we can now talk about the original question of "What can be done if my mail server goes down?". Going back to the above example lets say smtp.aol.com could not contact any of Broadview's mail servers. If this happens smtp.aol.com will place the mail into a queue. It will then wait for a while and retry to send the message. If it still can't contact to any of the mail serves it will once again place it in the queue. It will keep trying to send this message till the message is 5 days old. After 5 days it will bounce the message back to Joe, telling him it could not be sent. The customer would have 5 days to either fix their mail server or get a back up in place, before any mail would be bounced. Customers do not understand this so they request that we set up the MX records like this. somedomain.net preference = 0, mail exchanger = maila.somedoamin.net somedomain.net preference = 10, mail exchanger = c.mx.broadviewnet.net This seems like it would work and it will. If the customers mail server maila.somedoamin.net is down it will deliver the message to Broadview's mail server. This is assuming the domain is configured at Broadview to accept mail. While this will work in theory , in practice it is a bad idea. Lets say a lighting storm comes along and knocks the power out at the customers business. The customer, not having any backup power, now has a dead mail server. At the same time along comes smtp.aol.com again attempting to send bill@somedomain.net an e-mail with the latest dirt on Joes neighbor who happens to be running around with the milkman. When it sees that the customers mail server is down the primary MX record, it will fall back to the next one Broadview. Broadview's mail server will happily accept the message and place it in bills mailbox. In the mean time, the companies new web site is generating lots of new orders which Broadview is happily accepting. 10 minutes later the electricity comes back on and once again mail begins to flow into the customers mail server. Now the customer has mail sitting at Broadview that they may not know exists. If they would have had one MX record configured for their mail server then mail would have been queued and delivered once it came back up. Lets say a disaster happened, and the customers office exploded. Moments before this happened the IT guy at the company grabbed the mail server and ran from the building with it. Now smtp.aol.com is queuing mail like a madman. IT Guy then gets in his car and drives downtown to the companies second location. He sets up mail server but has no DSL line to plug into. Meanwhile smtp.aol.com and all the other servers on the internet are happily queuing mail for somedomain.net. The customer now needs to get their mail server back up. It's going to be longer that 5days and they don't want their mail to bounce. This is where we come in with our solution. Every customer gets a dial up account for free with their DSL connection. The customer sets up their mail server to dial in using their dial up username. We set up their dial up username with the same information their DSL connection had. Now their mail will be routed to their mail server over the dial up line. This can be used as a temporary solution till their DSL can be repaired. Hopefully this article has removed some of the mystery of mail and how mail servers work.