From: http://blog.chinaunix.net/u/12318/showart_65574.html
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