📜  电子邮件协议

📅  最后修改于: 2020-12-14 05:57:48             🧑  作者: Mango


电子邮件协议是一组规则,可以帮助客户端正确地向邮件服务器或从邮件服务器传输信息。在本教程的此处,我们将讨论各种协议,例如SMTP,POPIMAP。

SMPTP

SMTP代表简单邮件传输协议。它最初于1982年提出。它是用于在Internet上高效可靠地发送电子邮件的标准协议。

关键点:

  • SMTP是应用程序级别的协议。

  • SMTP是面向连接的协议。

  • SMTP是基于文本的协议。

  • 它处理通过TCP / IP网络在电子邮件服务器之间交换消息。

  • 除了传输电子邮件,SMPT还提供有关传入邮件的通知。

  • 当您发送电子邮件时,您的电子邮件客户端会将其发送到您的电子邮件服务器,该服务器进一步使用SMTP客户端与收件人邮件服务器联系。

  • 这些SMTP命令指定发件人和收件人的电子邮件地址,以及要发送的消息。

  • 服务器之间的命令交换是在没有任何用户干预的情况下进行的。

  • 如果无法传递邮件,则会将错误报告发送给发件人,这使SMTP成为可靠的协议。

SMTP命令

下表描述了一些SMTP命令:

S.N. Command Description
1 HELLO
This command initiates the SMTP conversation.
2 EHELLO
This is an alternative command to initiate the conversation. ESMTP indicates that the sender server wants to use extended SMTP protocol.
3 MAIL FROM
This indicates the sender’s address.
4 RCPT TO
It identifies the recipient of the mail. In order to deliver similar message to multiple users this command can be repeated multiple times.
5 SIZE
This command let the server know the size of attached message in bytes.
6 DATA
The DATA command signifies that a stream of data will follow. Here stream of data refers to the body of the message.
7 QUIT
This commands is used to terminate the SMTP connection.
8 VERFY
This command is used by the receiving server in order to verify whether the given username is valid or not.
9 EXPN
It is same as VRFY, except it will list all the users name when it used with a distribution list.

IMAP

IMAP代表Internet消息访问协议。它是1986年首次提出的。IMAP有五个版本,如下所示:

  1. 原始IMAP

  2. IMAP2

  3. IMAP3

  4. IMAP2bis

  5. IMAP4

关键点:

  • IMAP允许客户端程序在服务器上处理电子邮件,而无需在本地计算机上下载它们。

  • 该电子邮件由远程服务器保留和维护。

  • 它使我们能够执行任何操作,例如下载,删除邮件而不阅读邮件。它使我们能够创建,操作和删除称为邮箱的远程消息文件夹。

  • IMAP使用户可以搜索电子邮件。

  • 它允许并发访问多个邮件服务器上的多个邮箱。

IMAP命令

下表描述了一些IMAP命令:

S.N. Command Description
1 IMAP_LOGIN
This command opens the connection.
2 CAPABILITY
This command requests for listing the capabilities that the server supports.
3 NOOP
This command is used as a periodic poll for new messages or message status updates during a period of inactivity.
4 SELECT
This command helps to select a mailbox to access the messages.
5 EXAMINE
It is same as SELECT command except no change to the mailbox is permitted.
6 CREATE
It is used to create mailbox with a specified name.
7 DELETE
It is used to permanently delete a mailbox with a given name.
8 RENAME
It is used to change the name of a mailbox.
9 LOGOUT
This command informs the server that client is done with the session. The server must send BYE untagged response before the OK response and then close the network connection.

流行音乐

POP代表邮局协议。它通常用于支持单个客户端。 POP有多种版本,但POP 3是当前标准。

关键点

  • POP是应用程序层互联网标准协议。

  • 由于POP支持脱机访问邮件,因此需要较少的Internet使用时间。

  • POP不允许搜索功能。

  • 为了访问消息,有必要下载它们。

  • 它仅允许在服务器上创建一个邮箱。

  • 它不适用于访问非邮件数据。

  • POP命令通常缩写为三个或四个字母的代码。例如。 STAT。

POP命令

下表描述了一些POP命令:

S.N. Command Description
1 LOGIN
This command opens the connection.
2 STAT
It is used to display number of messages currently in the mailbox.
3 LIST
It is used to get the summary of messages where each message summary is shown.
4 RETR
This command helps to select a mailbox to access the messages.
5 DELE
It is used to delete a message.
6 RSET
It is used to reset the session to its initial state.
7 QUIT
It is used to log off the session.

POP和IMAP之间的比较

S.N. POP IMAP
1 Generally used to support single client. Designed to handle multiple clients.
2 Messages are accessed offline. Messages are accessed online although it also supports offline mode.
3 POP does not allow search facility. It offers ability to search emails.
4 All the messages have to be downloaded. It allows selective transfer of messages to the client.
5 Only one mailbox can be created on the server. Multiple mailboxes can be created on the server.
6 Not suitable for accessing non-mail data. Suitable for accessing non-mail data i.e. attachment.
7 POP commands are generally abbreviated into codes of three or four letters. Eg. STAT. IMAP commands are not abbreviated, they are full. Eg. STATUS.
8 It requires minimum use of server resources. Clients are totally dependent on server.
9 Mails once downloaded cannot be accessed from some other location. Allows mails to be accessed from multiple locations.
10 The e-mails are not downloaded automatically. Users can view the headings and sender of e-mails and then decide to download.
10 POP requires less internet usage time. IMAP requires more internet usage time.