SMTP protocol Principle

Source: Internet
Author: User
Tags domain list
SMTP protocol Principle
SMTP-Simple Mail Transfer
Protocol) is the protocol that defines mail transmission. It is an application layer protocol based on the TCP Service, defined by rfc0821. The commands specified by the smpt protocol are in plaintext. To
To describe how SMTP works, we will describe it by sending an email to www.linuxaid.com.cn.

In Linux, use "Telnet www.linuxaid.com.cn"
25 "connect to port 25 of www.linuxaid.com.cn (standard SMTP Service port); use Telnet in WindowsProgram, The remote host is specified
The interaction process is as follows:

[Lix @ NS lix] $ Telnet www.linuxaid.com.cn 25
Trying 202.99.11.120...
Connected to www.linuxaid.com.cn.
Escape Character is ^].

Helo ideal
220 www.linuxaid.com.cn ESMTP sendmail
8.10.2/8.10.2; Mon, 18 Sep 2000 13:40:44
+ 0800
250 www.linuxaid.com.cn hello
[210.12.114.130], pleased to meet you

Mail from: ideal@btamail.net.cn
250 2.1.0 IDEAL@btamail.net.cn... sender OK

Rcpt to: ideal@linuxaid.com.cn
250 2.1.5 ideal@linuxaid.com.cn... recipient OK

Data
354 enter mail, end with "." on a line by itself
Hello, pls to get to meet u good luck
.
250 2.0.0 e8i5j1m11204 message accepted for delivery

Quit
221 2.0.0 www.linuxaid.com.cn closing connection
Connection closed by foreign host.

The top part is the input command, and the other content is the status information output by the recipient's email server.

Here, Helo is a command sent by the customer to the recipient's email server to identify itself. Here we assume that the sender is ideal; mail
The from command is used to indicate the sender's email address; RCPT
To: identifies the recipient's email address, which indicates that you want to send an email to the ideal@linuxaid.com.cn if the recipient is not a local user, such as RCPT
To: ideal@btamail.net.cn, indicating that you want the recipient's mail server to forward (relay) the mail for yourself, if the machine allows such a mail, it indicates the mail server
The server is open.
Relay. Otherwise, the server does not allow relay. data indicates that the following is the data part of the email. After the input is complete, a row starting with "." is used as the end ID of the Data part;
Quit indicates that the session is exited and the email is sent.

This is a simple process of sending mail sessions. In fact, when using Outlook Express and other customer software to send emails, the background interaction is also like this. Of course, SMTP defines many commands and regulations to handle complex mail sending situations, such as attachments. You can refer to rfc821 for details.

When a friend of yours sends an email to you, his email server communicates with your email server through the SMTP protocol, send the email to the email server indicated by your email address (assume that your local
Local Mail Server is a Linux system). If you log on to the mail server directly through the Telnet protocol, you can use the client software such as mail to directly read the mail, but if you want to use the local
MUa (Mail User Agent, such as outlook
Express and other customer software) to read the mail, then the local client interacts with the mail server through POP3 or imap protocol, the mail information is transmitted to the client (such as Win98 system ). For example
If you reply a letter to your friend, the Mua you use also communicates with the mail service through the SMTP protocol (generally the email address corresponding to the mail address, instruct the desired email service
To forward an email to the email server specified by your friend's email address. If the local email server allows you to forward emails through it, the server sends emails to the recipient's email service through the SMTP protocol.
. This is the entire process of receiving and sending emails.

What is mail relay?
Generally, an email server has one or more domain names (these domain names should appear in a configuration file). When running, the mail server listens to port 25 and waits for a remote email sending request. Network
Other mail servers or Mua (Mail User Agent, such as outlook
Express, Foxmail, etc.) will connect to port 25 of the mail server and request to send the mail. The SMTP session process generally starts from remotely identifying your identity. The process is as follows:

Helo remote. system. domainname
250 qmailserver. Domain

Mail from: user@somewherer.net
250 OK

Rcpt to: user1@elsewhere.net
The domain name in the recipient's user1@elsewhere.net is not necessarily the local domain name of the email receiving server, that is, the Mail may not be the recipient of the above Protocol interaction, instead, the mail sender wants to receive the mail server to help it forward the mail. At this time, the local system may have two answers:

250 OK

Or refuse to accept it:

553 sorry,. that domain isnot in my domain list of allowed recphosts

In the first case, the local mail server allows relay. It receives and agrees to pass a destination address that is not a local mail; in the second case, it does not receive non-local mail.

Why cannot I configure the email server as open relay?

If the system administrator sets his email server to open
Relay will cause some spammers to use your email server as a relay station for forwarding self-forwarded emails, which will direct the recipient of the spam mail to you, it may cause revenge email bombs;
Spam also consumes a lot of resources and bandwidth. Even worse, your name may be blacklisted and become a target shared by other Email recipients. Your emails will be received by these recipients.
Rejected.

Therefore, the system administrator should be careful not to make the email server open relay.

Self: http://www.chinaasp.com/aspbbs/web/club/bbs/showEssence.asp? Id = 13020

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.