大网数据广告活动
服务器运维问答

DNS , MX and SMTP. Mail storage

· 52CE 我爱测

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 [email omitted] When we are sending letter …

问题原文

原帖链接 · CROSP · CC BY-SA 3.0

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 [email omitted]

  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.

已采纳解答

原帖链接 · Kondybas · CC BY-SA 3.0

  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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。