How E-mail Works

本文详细解析了电子邮件系统的运作机制,从简单的邮件服务器到复杂的SMTP及POP3服务器交互过程,再到附件的处理方式,揭示了电子邮件背后的技术秘密。
 How E-mail Works
 

Every day the citizens of the Internet send each other billions of e-mail messages. If you are online a lot, you yourself may send a dozen or two e-mails each day without even thinking about it. Obviously, e-mail has become an extremely popular communication tool in a very short time!

Have you ever wondered how e-mail gets from your desktop to a friend halfway around the world? What is a POP3 server, and how does it hold your mail? The answers may surprise you, because it turns out that e-mail is an incredibly simple system at its core!

What is an E-mail Message?
Apparently, the first e-mail message was sent in 1971 by an engineer named Ray Tomlinson. Prior to this, you could only send messages to users on a single machine. Tomlinson's breakthrough was the ability to send messages to other machines on the Internet, using the @ sign to designate the receiving machine.

An e-mail message has always been nothing more than a simple text message, a piece of text sent to a recipient. When you send an e-mail message to a friend, you are sending a piece of text. In the beginning and even today, e-mail messages tend to be short pieces of text, although the ability to add attachments now makes many e-mail messages quite long. Even with attachments, however, e-mail messages continue to be text messages -- we'll see why when we get to attachments.

Understanding E-mail Clients
You have probably already received several e-mail messages today. To look at them you use some sort of e-mail client. Examples include stand-alone software, free Web e-mail service, and e-mail service that requires payments. No matter which type of client you are using, you know that an e-mail client generally does four things:

  • It shows you a list of all of the messages in your mailbox by displaying the message headers. The header shows you who sent the mail and the subject of the mail, and may also show the time and date of the message and the message size.
  • It lets you select a message header and read the body of the e-mail message.
  • It lets you create new messages and send them. You type in the e-mail address of the recipient and the subject for the message, and then type the body of the message.
  • Most e-mail clients also let you add attachments to messages you send and save the attachments from messages you receive.

    Sophisticated e-mail clients may have all sorts of bells and whistles, but at the core, this is all that an e-mail client does.

    Understanding a Simple E-mail Server
    Given that you have an e-mail client on your machine, you are ready to send and receive e-mail. All that you need is an e-mail server for the client to connect to. Let's imagine what the simplest possible e-mail server would look like in order to get a basic understanding of the process. Then we will look at the real thing.

    If you have read the How Stuff Works article entitled How Web Servers and the Internet Work, then you know that machines on the Internet can run software applications that act as servers. There are Web servers, FTP servers, telnet servers and e-mail servers running on millions of machines on the Internet right now. These applications run all the time on the server machine and they listen to specific ports waiting for people or programs to attach to the port. The simplest possible e-mail server might look like this:

  • It would have a list of e-mail accounts, with one account for each person who can receive e-mail on the server. My account name might be mbrain, John Smith's might be jsmith, and so on.
  • It would have a text file for each account in the list. So the server would have a text file in its directory named MBRAIN.TXT, another named JSMITH.TXT, and so on.
  • When someone wants to send me a message, the person composes a text message ("Marshall, Can we have lunch Monday? John") in an e-mail client, and indicates that the message should go to mbrain.
  • When the person presses the Send button, the e-mail client would attach to the e-mail server and pass to the server the name of the recipient (mbrain), the name of the sender (jsmith) and the body of the message.
  • The server would format those pieces of information and append them to the bottom of the MBRAIN.TXT file. The entry in the file might look like this:
    • From: jsmith
      To: mbrain
      Marshall, Can we have lunch Monday? John
 

There are several other pieces of information that the server might save into the file, like the time and date of receipt and a subject line, but overall you can see that this is an extremely simple process!

As other people send mail to mbrain, the server would simply append those messages to the bottom of the file in the order that they arrive. The text file would accumulate a series of five or 10 messages, and eventually I would log in to read them. When I want to look at my e-mail, my e-mail client would connect to the server machine. In the simplest possible system it would:

  • Ask the server to send a copy of the MBRAIN.TXT file.
  • Ask the server to erase and reset the MBRAIN.TXT file.
  • Save the MBRAIN.TXT file on my local machine.
  • Parse the file into the separate messages (using the word "From:" as the separator).
  • Show me all of the message headers in a list.

    When I double-click on a message header, it would find that message in the text file and show me its body.

    You have to admit that this is a VERY simple system. Surprisingly, the real e-mail system that you use every day is not much more complicated than this!

    Understanding the Real E-mail System
    For the vast majority of people right now, the real e-mail system consists of two different servers running on a server machine. One is called the SMTP Server, where SMTP stands for Simple Mail Transfer Protocol. The SMTP server handles outgoing mail. The other is a POP3 Server, where POP stands for Post Office Protocol. The POP3 server handles incoming mail. The SMTP server listens on well-known port number 25, while POP3 listens on port 110 . A typical e-mail server looks like this:

     

    e-mail server

    Understanding SMTP
    Whenever you send a piece of e-mail, your e-mail client interacts with the SMTP server to do the sending. The SMTP server on your host may have conversations with other SMTP servers to actually deliver the e-mail.

     

    SMTP Diagram

    Let's assume that I want to send a piece of e-mail. My e-mail ID is brain and I have my account on howstuffworks.com. I want to send e-mail to jsmith@mindspring.com. I am using a stand-alone e-mail client like Outlook Express.

    When I set up my account at howstuffworks, I told Outlook Express the name of the mail server -- mail.howstuffworks.com. When I compose a message and press the Send button, here is what happens:

  • Outlook Express connects to the SMTP server at mail.howstuffworks.com using port 25.
  • Outlook Express has a conversation with the SMTP server. The conversation is an extremely simple set of text commands and responses (see below). Outlook express tells the SMTP server the address of the sender and the address of the recipient, as well as the body of the message.
  • The SMTP server takes the "TO" address (for example, jsmith@mindspring.com) and breaks it into two parts: 1) the recipient name (jsmith) and 2) the domain name (mindspring.com). If the TO address had been another user at howstuffworks.com, the SMTP server would simply hand the message to the POP3 server for howstuffworks.com (using a little program called the delivery agent). Since the recipient is at another domain, SMTP needs to communicate with that domain.
  • The SMTP server has a conversation with a Domain Name Server and says, "Can you give me the IP address of the SMTP server for mindspring.com?" The DNS replies with the one or more IP addresses for the SMTP server(s) that Mindspring operates.
  • The SMTP server at howstuffworks.com connects with the SMTP server at Mindspring using port 25. It has the same simple text conversation that my e-mail client had with the SMTP server for How Stuff Works, and gives the message to the Mindspring server. The Mindspring server recognizes that the domain name for jsmith is at Mindspring, so it hands the message to Mindspring's POP3 server, which puts the message in jsmith's mailbox.

    If, for some reason, the SMTP server at How Stuff Works cannot connect with the SMTP server at Mindspring, then the message goes into a queue. The SMTP server on most machines uses a program called sendmail to do the actual sending, so this queue is called the sendmail queue. Sendmail will periodically try to resend the messages in its queue. For example, it might retry every 15 minutes. After four hours it will usually send you a piece of mail so that you know there is some sort of problem. After five days, most sendmail configurations give up and return the mail to you undelivered.

    The actual conversation that an e-mail client has with an SMTP server is incredibly simple and human readable. It is specified in public documents called Requests For Comments (RFC) and a typical conversation might look something like this:

    • helo test 250 mx1.mindspring.com Hello abc.sample.com [220.57.69.37], pleased to meet you mail from: test@sample.com 250 2.1.0 test@sample.com... Sender ok rcpt to: jsmith@mindspring.com 250 2.1.5 jsmith... Recipient ok data 354 Enter mail, end with "." on a line by itself from: test@sample.com to:jsmith@mindspring.com subject: testing John, I am testing... . 250 2.0.0 e1NMajH24604 Message accepted for delivery quit 221 2.0.0 mx1.mindspring.com closing connection Connection closed by foreign host.

    What the e-mail client says is in red, and what the SMTP server replies with is in green. The e-mail client introduces itself, indicates the from and to addresses, delivers the body of the message and then quits. You can, in fact, telnet to a mail server machine at port 25 and have one of these dialogs yourself -- this is how people "spoof" e-mail.

 

You can see that the SMTP server understands very simple text commands like HELO, MAIL, RCPT and DATA. The list of most common commands is:

  • HELO - introduce yourself
  • EHLO - introduce yourself and request extended mode
  • MAIL FROM: - specify the sender
  • RCPT TO: - specify the recipient
  • DATA - specify the body of the message. To:, From: and Subject: should be the first three lines.
  • RSET - reset
  • QUIT - quit the session
  • HELP - get help on commands
  • VRFY - verify an address
  • EXPN - expand an address
  • VERB - verbose

    Understanding the POP3 Server
    In the simplest implementations of POP3, the server really does maintain a collection of text files -- one for each e-mail account. When a message arrives, the POP3 server simply appends it to the bottom of the recipient's file!

    When you check your e-mail, your e-mail client connects to the POP3 server using port 110. The POP3 server requires an account name and a password. Once you have logged in, the POP3 server opens your text file and allows you to access it. Like the SMTP server, the POP3 server understands a very simple set of text commands. Here are the most common commands:

  • USER - enter your user ID
  • PASS - enter your password
  • QUIT - quit the POP3 server
  • LIST - list the messages and their size
  • RETR - retrieve a message number, pass it a message number
  • DELE - delete a message, pass it a message number
  • TOP - shows the top x lines of a message, pass it a message number and the number of lines

    Your e-mail client connects to the POP3 server and issues a series of commands to bring copies of your e-mail messages to your local machine. Generally it will then delete the messages from the server (unless you've told the e-mail client not to).

    You can see that the POP3 server simply acts as an interface between the e-mail client and the text file containing your messages. And again you can see that the POP3 server is extremely simple! You can connect to it through telnet at port 110 and issue the commands yourself if you would like .

    Understanding Attachments
    Your e-mail client allows you to add attachments to e-mail messages you send, and also lets you save attachments from messages that you receive. Attachments might include word processing documents, spreadsheets, sound files, snapshots, pieces of software, etc. Usually an attachment is not text (if it was, you would simply include it in the body of the message). Since e-mail messages can contain only text information and since attachments are not text, there is a problem that needs to be solved.

    In the early days of e-mail, you solved this problem by hand using a program called uuencode. The uuencode program assumes that the file contains binary information. It extracts three bytes from the binary file and converts them to four text characters (that is, it takes 6 bits at a time, adds 32 to the value of the 6 bits and creates a text character). What uuencode produces, therefore, is an encoded version of the original binary file that contains only text characters. In the early days of e-mail, you would run uuencode yourself and paste the uuencoded file into your e-mail message.

    Here is typical output from the uuencode program:

    • begin 644 reports
      M9W)E<" B<&P_(B O=F%R+VQO9R]H='1P9"]W96(V-C1F- BYA8V-<W,N;&]GM('P@8W5T("UF(#(@+60@(C/B('P@8W5T ("UF(#$@+60@(B8B(#X@<V5A<F-HM+61A=&$M)#$*?B]C; W5N="UP86=E<R!/('-O<G0@/B!S=&%T<RTD,0IC< " @M?B]W96)S:71E+V-G:2UB:6XO<W5G9V5S="UD871A+V1A= &$@<W5G9V5S="TDM,0IC<"!^+W=E8G-I=&4O8V=I+6)I;B ]W:&5R92UD871A+V1A=&$@=VAE<F4MM)#$*8W @?B]W96)S:7 1E+V-G:2UB:6XO96UA:6QE<BUD871A+V1A=&$@96UAL:6PM)# $*?B]G971L;V<@/B!L;V=S+20Q
      End
    The recipient would then save the uuencoded portion of the message to a file and run uudecode on it to translate it back to binary. The word "reports" in the first line tells uudecode what to name the output file.

    Modern e-mail clients are doing exactly the same thing, but they run uuencode and uudecode for you automatically. If you were to look at a raw e-mail file that contains attachments, you would find that the attachment is represented in the same uuencoded text format shown above!

    The Simplicity of E-mail
    From this description, you can see that today's e-mail system is one of the simplest things ever devised! There truly is nothing to it. There are parts of the system -- like the routing rules in sendmail -- that get complicated, but overall the system is as simple as it can possibly be.

    The next time you send an e-mail, you will now have the comfort of knowing exactly what is going on behind the scenes!

 
代码转载自:https://pan.quark.cn/s/8ce4326d996e 对于在 CentOS 7 系统中修改网卡配置文件后无法使设置生效的情况,经过实践验证,可以通过使用 nmcli 命令来进行调整。完成修改之后,需要重新启动虚拟机以使更改生效,这样操作流程即告完成。如果设置仍然无法生效,则表明虚拟机在启动过程中所获取的 IP 地址配置并非针对 eth0,此时可以对其它网卡的配置文件进行修改或将其移除。在 CentOS 7 系统中,网络配置的管理机制与早期版本存在差异,主要体现为采用了 Network Manager 服务来负责网络接口的管理。在某些情形下,尽管修改了 `/etc/sysconfig/network-scripts` 目录下的 `ifcfg-eth0` 文件,但网络配置却未能即时生效。此类问题的发生通常源于 CentOS 7 采用了不同于以往的配置读取方法。接下来将具体阐述如何借助 nmcli 命令来处理这一挑战。 以 root 用户身份登录系统并打开终端界面。nmcli 是 Network Manager 提供的命令行界面工具,它支持在命令行环境下执行网络连接的建立、编辑、查询及管理任务。针对修改 eth0 网卡配置的需求,可以遵循以下步骤进行操作: 1. 导航至 `/etc/sysconfig/network-scripts` 目录: ``` cd /etc/sysconfig/network-scripts ``` 2. 检查该目录内是否存在 `ifcfg-eth0.bak` 文件,该备份文件可能是先前调整配置时遗留下来的,若存在可能造成冲突。若发现该文件,可以选择将其删除: ``` [root@localhost netw...
代码转载自:https://pan.quark.cn/s/46fd08fb879c 网管教程 从入门到精通软件篇 ★一。★详尽的xp修复控制台指令及其应用!!! 放入xp(2000)的光盘,安装时选择R,执行修复! Windows XP(涵盖 Windows 2000)的控制台指令是在系统遭遇某些意外状况时的一种极具效用的诊断、检测以及恢复系统功能的工具。笔者确实一直期望能够将这方面的指令进行归纳,此次由老范辛苦整理了这份极具价值的秘籍。 Bootcfg bootcfg 命令用于启动配置与故障恢复(对大多数计算机而言,即 boot.ini 文件)。 带有特定参数的 bootcfg 命令仅在运用故障恢复控制台时方可使用。能够在命令行界面下运用带有不同参数的 bootcfg 命令。 用法: bootcfg /default 设定默认引导选项。 bootcfg /add 向引导清单中增添 Windows 安装。 bootcfg /rebuild 重复整个 Windows 安装流程并让用户选择需添加的项目。 注意:运用 bootcfg /rebuild 之前,应先借助 bootcfg /copy 命令备份 boot.ini 文件。 bootcfg /scan 探查用于 Windows 安装的全部磁盘并展示结果。 注意:这些结果被静态存储,并用于当前会话。若在当前会话期间磁盘配置发生变动,为获取更新的探查结果,必须先重启计算机,然后再次探查磁盘。 bootcfg /list 列示引导清单中已有的项目。 bootcfg /disableredirect 在启动引导程序中禁用重定向。 bootcfg /redirect [ PortBaudRrate] |[ useBio...
代码下载链接: https://pan.quark.cn/s/fc524f791b68 AA制程,即Active Alignment,被理解为主动对准,是一种用于确定零部件装配中相对位置的方法。在摄像头封装阶段,涉及图像传感器、镜座、马达、镜头、线路板等多个部件的重复组装,而传统的封装设备如CSP及COB等,均是依据设备设定的参数进行零部件的移动装配,因而零部件的叠加误差会逐渐增大,最终在摄像头上表现为拍照最清晰的位置可能偏离画面中心、四边清晰度不均等现象。伴随智能手机和其他高端电子产品的普及,摄像头模组的性能正日益受到重视。高分辨率、卓越的低光表现以及稳定视频输出是现代用户所期望的。在摄像头模组的制造环节,各部件的精准定位对成像质量具有决定性作用。因此,一种名为“AA制程”(Active Alignment)的前沿技术被开发出来,成为摄像头精密对准的核心技术。 AA制程,即Active Alignment,是一种在摄像头封装过程中应用的主动对准方法。该方法在多个组件装配阶段发挥作用,涵盖图像传感器、镜座、马达、镜头和线路板等部件。传统的封装方式,例如CSP(Chip Scale Package)和COB(Chip On Board),依赖于设备预设的参数进行组装,但随着组件数量的增加,误差也会累积,最终影响摄像头的表现。例如在成像质量上可能出现中心位置偏移、四角清晰度不一致等问题。 AA制程技术的核心在于实时监测与主动调整。在组装过程中,它借助先进的检测设备持续监控半成品的状态,并根据实时信息对组装部件进行精确修正,从而显著降低装配误差。通过这种技术,能够确保摄像头模组中各组件的相对位置准确无误,从而使得最终的成像效果更加稳定,特别是在中心区域和四角的清晰度上...
内容概要:本文介绍了一套基于Matlab实现的光子晶体90度弯曲波导的二维时域有限差分法(2D FDTD)仿真代码,旨在通过数值模拟手段深入研究光子晶体波导中的光传播特性。该资源聚焦于电磁场与光子学领域的仿真技术应用,系统实现了FDTD算法在复杂介质结构中的建模过程,涵盖空间网格剖分、时间步进迭代、完美匹配层(UPML)边界条件处理、总场散射场(TFSF)激励源设置、介电常数分布定义及电磁场演化可视化等核心模块,能够有效分析光在90度弯曲波导中的传输效率、模式分布与反射损耗等关键性能指标。; 适合人群:具备电磁场理论基础和Matlab编程能力的研究生、科研人员以及从事光子晶体器件设计与仿真的工程技术人员。; 使用场景及目标:①用于教学演示FDTD方法的基本原理与算法流程,帮助理解麦克斯韦方程的离散化求解过程;②支撑科研工作中对光子晶体弯曲波导结构的传输特性进行仿真分析与性能优化;③作为开发更复杂光子集成器件(如分束器、滤波器)数值仿真工具的基础框架; 阅读建议:建议使用者结合经典FDTD教材(如Taflove著作)深入理解算法理论,并在Matlab环境中逐模块调试代码,重点关注电场与磁场的交替更新过程、UPML吸收边界的设计实现以及TFSF源的引入方式,从而全面提升对时域电磁仿真机制的掌握与应用能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值