A POP3 and SMTP command from Baidu Library
POP3 commands
What is POP3?
POP3 (Post Office Protocol 3) is the 3rd version of the Post Office Protocol. It specifies how to connect a personal computer to an Internet Mail Server and download an email Protocol. It is the first offline protocol standard for Internet email. POP3 allows you to store emails on the server to a local host (your computer, delete the emails stored on the mail server, while the POP3 server receives emails from the mail server following the POP3 protocol.
POP3 command
POP3 commands include:
USER username
PASS password
APOP name, digest recognizes a secure transmission password method. If the password is successfully transferred, the status is converted. For details, see RFC 1321.
STAT processes server send-back mailbox statistics, such as number of mails and total number of bytes
The UIDL n processing server returns the unique identifier used for the specified email. If no unique identifier is specified, all emails are returned.
LIST n processes the size of the specified email returned by the server, etc.
RETR n processes all text returned by the server
DELE n processes the server tag deletion, Which is deleted only when the QUIT command is executed.
RSET process undo all DELE commands
TOP n, m processing returns the content of the first m lines of the n mail, and m must be a natural number
NOOP processes the server and returns a positive response.
QUIT wants to end the session. If the server is in the "processing" status, it is now in the "Update" status to delete the emails marked as deleted. If the server is in the "approved" status, the server does not enter the "Update" status when the session ends.
Connect to Winmail Server via telnet to receive emails
For example, the IP address of the email server that installs Winmail is 192.168.0.1 (the Blue font content is input by the client, and the red font content is returned by the service)
Telnet 119.119.119.212 110 ------------------------------- use the telnet command to connect to port 110 of the server
Trying 119.119.119.212... -------------------------------- connecting to port 110 of the server
Connected to 119.119.119.212. ------------------------ connection to port 110 of the server is successful.
+ OK Winmail Mail Server POP3 ready
User username ------------------------------------------ enter the user name. username is the specific user name.
+ OK ---------------------------------------------------- the command is successfully executed.
Pass password ------------------------------------------ enter the user password. The password is the specific password.
+ OK 2 messages ----------------------------------------- pass password authentication
(-ERR authorization failed ----------------------------- password authentication failed)
Stat ----------------------------------------------------- mailbox status
+ OK 2 6415 --------------------------------------------- 2 indicates the total number of mails in the mailbox, and 6415 indicates the total number of bytes.
List --------------------------------------------------- list the bytes of each email
+ OK -------------------------------------------------- the command is successfully executed and displayed. The mail serial number is displayed on the left and the mail size is displayed on the right.
1 537 -------------------------------------------------- 1st emails in 537 bytes
2 5878 ------------------------------------------------- 2nd emails in 5878 bytes
.
Top 1 -------------------------------------------------- receive 1st emails
+ OK ---------------------------------------------------- received successfully, 1st mail headers are returned
Return-Path: <test1@look.com>
Delivered-To: test2@look.com
Received: (winmail server invoked for smtp delivery); Mon, 25 Oct 2004 14:24:27 + 0800
From: test1@look.com
To: test2@look.com
Date: Mon, 25 Oct 2004 14:24:27 + 0800
Subject: test mail
.
Retr 1 --------------------------------------------------- receive 1st emails
+ OK ---------------------------------------------------- the message is received successfully, and all content of the 1st emails is returned.
Return-Path: <test1@look.com>
Delivered-To: test2@look.com
Received: (winmail server invoked for smtp delivery); Mon, 25 Oct 2004 14:24:27 + 0800
From: test1@look.com
To: test2@look.com
Date: Mon, 25 Oct 2004 14:24:27 + 0800
Subject: test mail
Hi, test2
This is a test mail, you don't reply it.
.
Dele 1 --------------------------------------------------- Delete 1st emails
+ OK ---------------------------------------------------- deleted successfully
Dele 2 --------------------------------------------------- Delete 2nd emails
+ OK ---------------------------------------------------- deleted successfully
Quit --------------------------------------------------- end the session
+ OK ---------------------------------------------------- the command is successfully executed.
SMTP commands
What is SMTP
SMTP (Simple Mail Transfer Protocol): the transmission Protocol used to transmit an email from a client to a server or from one server to another. SMTP is a request/response protocol. commands and responses are based on ASCII text and end with CR and LF characters. The response includes a three-digit code that indicates the returned status. SMTP listens for connection requests on TCP port 25.
What is ESMTP?
ESMTP (Extended SMTP), as its name implies, is an extension of the standard SMTP protocol. It differs from the SMTP service in that the user account does not need to be verified when sending mail via SMTP. When sending mail via ESMTP, the server requires the user to provide the user name and password for authentication. The email sending process after verification is no different from the SMTP method.
SMTP command
SMTP commands include:
HELO identifies the user to the server. The sender can cheat and lie, but generally the server can detect it.
EHLO identifies the user to the server. The sender can cheat and lie, but generally the server can detect it.
The address specified in the mail from command is the sender address.
Rcpt to identifies a single email recipient; multiple rcpt to can be used; it is often behind the MAIL command.
After one or more RCPT commands, DATA indicates that all Email recipients have been identified, and DATA transmission is initialized, ending with CRLF. CRLF.
VRFY is used to verify whether the specified user or email address exists. This command is often disabled by the server for security reasons.
EXPN verifies whether the specified mailbox list exists and expands the mailbox list.
HELP query commands supported by the server
No NOOP operation, the server should respond OK
RSET resets the session and the current transmission is canceled.
QUIT end session
Connect to Winmail Server and use SMTP commands to send emails
For example, the IP address of the email server that installs Winmail is 192.168.0.1 (the Blue font content is input by the client, and the red font content is returned by the service)
Telnet 192.168.0.1 25 ----------------------------------------- use the telnet command to connect to port 25 of the server
Trying 192.168.0.1... --------------------------------------------- connecting to port 25 of the server
Connected to 192.168.0.1. ----------------------------------- port 25 of the server is successfully Connected.
220 Winmail Mail Server ESMTP ready ----------------------- display the Server ID name (Winmail management tools-> advanced settings-> system parameters-> basic parameters can be changed)
Helo cnu.com ------------------------------------------------ identify the user to the server, do not authenticate the mail, skip the following steps to directly send the mail from command
250 Winmail Mail Server
Ehlo cnu.com -------------------------------------------------- ESMTP command, the mail must be authenticated.
250-Winmail Mail Server
250-PIPELINING
250-AUTH = LOGIN PLAIN
250-AUTH LOGIN PLAIN
250-SIZE 20480000
250 8 BITMIME
Auth login ------------------------------------------------- perform user Identity Authentication
334 VXNlcm5hbWU6
Y29zdGFAYW1heGl0Lm5ldA = ----------------------------------- BASE64 encrypted user name
334 UGFzc3dvcmQ6
MTk4MjIxNA ==------------------------------------------------- BASE64 encrypted password
235 auth successfully ---------------------------------------- authentication successful
(535 auth failure -------------------------------------------- failed to authenticate)
Accounts sent to the domain name in the system can skip identity authentication.
Mail from: <test1@domain.com> ------------------------------ mail from address test1@domain.com
250 OK ------------------------------------------------------- Command Execution successful
Rcpt to: <test2@domain.com> -------------------------------- delivered to address test2@domain.com
250 OK ------------------------------------------------------- Command Execution successful
Data --------------------------------------------------------- data transmission Initialization
354 go ahead ------------------------------------------------- start Data Transmission
From: test1@domain.com
To: test2@domain.com
Date: Mon, 25 Oct 2004 14:24:27 + 0800
Subject: test mail
Hi, test2
This is a test mail, you don't reply it.
.
------------------------------------------------------------ Data content, including BASE64 encrypted mail content, ends data transmission with CRLF. CRLF
250 OK message accepted for delivery ----------------------- Command Execution successful
Quit --------------------------------------------------------- end the session
221 Winmail Mail Server
Connection closed by foreign host. ------------------------- disconnect