1

I have basic understanding of how everything works. But I want to get better understanding and dive deeper.

I will how do I understand all these stuff. Consider we are sending letter to hello@world.com

  1. When we are sending letter firstly DNS resolves world.com domain.
  2. It asks . DNS server than it is redirected to .com. DNS zone server and than to the NS server/servers that are responsible for storing info about world.com domain. We can change(redirect to another) NS servers in domain control panel.
  3. After finding proper NS server which is responsible for providing information about this domain it retrieves data about MX record.
  4. Mail is sent to the SMTP server specified in MX record using SMTP protocol
  5. Because we are not using POP3 protocol over letter is saved on the SMTP server responsible for maintenance of our domain (MX record).
  6. So SMTP server backups all our mail on the server and we can access our mail from anywhere using IMAP protocol.

Am I right ? Most of time MX record has hoster mail servers specified.

So my main question is

If I change MX record of my domain to another server, than I will lost all mail history ? Or it is possible to transfer mail to new server ? And if I switch back again to old SMTP server will I find all my mail there or it will be removed ?

Maybe I am completely wrong, but I will be grateful for any help.

1
  1. MX (SMTP-server aka MTA) can be configured as destination or relay for some mail domain(s).

  2. If it is configured as relay, message will be sent to another MTA that can be destination or relay too. And so forth. MX here is just an entrance point. Message can be routed to the different destinations, duplicated, terminated etc. That is how complex mail infrastructures look inside. Step by step message will be routed to the host, configured as destination. Otherwise, after some number of steps, message will be rejected as non-deliverable.

  3. If host is configured as destination, messages are stored locally. That process is performed by Local Delivery Agent - LDA. All SMTP servers have some LDA functionality, so they can store messages at least in the mailbox format. Mailbox is just a plain file with messages appended one by one. Alternatively messages can be stored in the maildir or even in the databases like mysql or postgres.

  4. From the local storage messages can be fetched by Mail User Agent or MUA like mutt or mail utilities. But if your messages are stored on the remote host, you need some service like POP3 or IMAP to fetch messages over network.

So messages are stored on the host not because there is no POP3 on the MX. That is happens because MX is configured as destination for domain and LDA is configured properly. Otherwise message will be returned to the sender with notification: can't deliver.

If I change MX record of my domain to another server, than I will lost all mail history ? Or it is possible to transfer mail to new server ?

The common approach is to configure your MX as relay that will route all the mail to the server, configured as destination. You can change MXses as you wish as long as they relay to the same destination server. But you also can physically move your mail storage to the other server as far as it's just plain files.

Popular email software like sendmail, postfix, exim, qmail, dovecot etc are powerful enough to build any configuration you want. But that require strong knowledge and skills, as far as you can easily become the victim of spammers who can use poorly configured server as spamgun.

1

Let's say old mail server is mail1.world.comand that new server is mail2.world.com. MX record pointing to old server would be

world.com in mx 0 mail1.world.com.

and mx record pointing to new:

world.com in mx 0 mail2.world.com.

What happens when you change your mx record is the mail will be delivered to server responding to new mx record - mail2.world.com. New server doesn't have any notion about activities on old server, it has no content (accounts, messages, logs, settings), unless you configure everything first and copy content from old server. As for changing setting to old server. Mail server will function same is it's working now and with all content it had previously, unless you have scripts that are clearing old messages. You should be able to access both servers no matter where mx record is pointing, only difference is that mail for your domain will be deliverd to server mx is pointing to.

Hope this clears things a bit.

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.