contents
下一步: 邮件是如何被投递的? 向上: 电子邮件 前一步: 电子邮件

什么是邮件消息?

邮件消息通常由消息体和特殊数据组成,消息体是发送者编写的文本,特殊数据则指定了接收者、传输介质等,非常像您看到的信封上的内容。

这些管理数据分为两类;第一类是特定于传输介质的任何数据,例如发送者和接收者的地址。因此,它被称为信封。当消息传递时,传输软件可能会对其进行转换。

第二类是处理邮件消息所需的任何数据,这些数据并非特定于任何传输机制,例如消息的主题行、所有接收者的列表以及消息的发送日期。在许多网络中,将此数据前置到邮件消息已成为标准做法,从而形成了所谓的邮件头。邮件头和邮件正文之间用一个空行分隔。gif

世界上大多数邮件传输软件都使用 RFC-822 中概述的头部格式。其最初目的是指定在 ARPANET 上使用的标准,但由于其设计为独立于任何环境,因此很容易适应其他网络,包括许多基于 UUCP 的网络。

然而,RFC-822 只是最大的公约数。为了应对不断增长的需求,例如数据加密、国际字符集支持和多媒体邮件扩展 (MIME),已经构思了更新的标准。

在所有这些标准中,头部由多行组成,行与行之间用换行符分隔。一行由字段名和字段本身组成,字段名从第一列开始,字段本身与字段名之间用冒号和空格分隔。每个字段的格式和语义因字段名而异。如果下一行以 TAB 字符开头,则头部字段可以跨越多行。字段可以以任何顺序出现。

一个典型的邮件头可能看起来像这样

           From brewhq.swb.de!ora.com!andyo Wed Apr 13 00:17:03 1994
           Return-Path: 
           Received: from brewhq.swb.de by monad.swb.de with uucp
                   (Smail3.1.28.1 #6) id m0pqqlT-00023aB; Wed, 13 Apr 94 00:17
           Received: from ora.com (ruby.ora.com) by brewhq.swb.de with smtp
                   (Smail3.1.28.1 #28.6) id ; Tue, 12 Apr 94 2
           Received: by ruby.ora.com (8.6.8/8.6.4) id RAA26438; Tue, 12 Apr 94
           Date: Tue, 12 Apr 1994 15:56:49 -0400
           Message-Id: <199404121956.PAA07787@ruby>
           From: andyo@ora.com (Andy Oram)
           To: okir@monad.swb.de
           Subject: Re: Your RPC section
通常,所有必要的头部字段都由您使用的邮件客户端界面生成,例如 elm、pine、mush 或 mailx。然而,有些是可选的,可以由用户添加。例如,elm 允许您编辑消息头的一部分。其他字段由邮件传输软件添加。下面列出了一些常见的头部字段及其含义
          From: This  contains  the  sender's  email address, and possibly the
                ``real name''. A complete zoo of formats is used here.


            To: This is the recipient's email address.


       Subject: Describes the content of the mail in a  few  words.  At  least
                that's what it should do.


          Date: The date the mail was sent.


      Reply-To: Specifies  the  address the sender wants the recipient's reply
                directed to. This may be useful if you have several  accounts,
                but  want  to receive the bulk of mail only on the one you use
                most frequently. This field is optional.

      Organization: The organization that owns the machine from which the mail
                originates.  If your machine is owned by you privately, either
                leave this out, or insert ``private'' or  some  complete  non-
                sense.  This field is optional.


      Message-ID: A string generated by mail transport on the originating sys-
                tem.  It is unique to this message.


      Received: Every site that processes your mail (including the machines of
                sender  and  recipient)  inserts such a field into the header,
                giving its site name, a message id, time and date it  received
                the  message, which site it is from, and which transport soft-
                ware was used. This is so that you can trace which  route  the
                message  took,  and  can complain to the person responsible if
                something went wrong.
      X-anything: No mail-related programs should complain  about  any  header
                which  starts with X-. It is used to implement additional fea-
                tures that have not yet made it into an RFC,  or  never  will.
                This is used by the Linux Activists mailing list, for example,
                where the channel is selected by the X-Mn-Key: header field.

此结构的唯一例外是第一行。它以关键字 From 开头,后跟一个空格而不是冒号。为了将其与普通的 From: 字段区分开来,它通常被称为 From_。它包含消息在 UUCP bang-path 风格(如下所述)中经过的路由,最后处理它的机器接收到消息的时间和日期,以及一个可选部分,用于指定从哪个主机接收到消息。由于此字段由处理消息的每个系统重新生成,因此有时将其归入信封数据之下。

From_ 字段的存在是为了向后兼容一些较旧的邮件程序,但现在已不再常用,除非邮件用户界面依赖它来标记用户邮箱中消息的开始。为了避免消息正文中以 ``From '' 开头的行造成潜在的麻烦,也已成为标准做法,即通过在其前面加上 ``>'' 来转义任何此类情况。


contents
下一步: 邮件是如何被投递的? 向上: 电子邮件 前一步: 电子邮件

安德鲁·安德森
1996 年 3 月 7 日星期四 23:22:06 EST