List of All Simple Mail Transfer Protocol (SMTP) Commands

Source: Internet
Author: User
Keywords list of all smtp commands smtp command line test smtp commands attachment example
SMTP is short for Simple Mail Transfer Protocol.
Email is an indispensable tool in daily work and life. Below is the process of sending and receiving emails.
Simple Application Server
USD1.00 New User Coupon
* Only 3,000 coupons available.
* Each new user can only get one coupon(except users from distributors).
* The coupon is valid for 30 days from the date of receipt.

The sending of mail is mainly realized through the SMTP protocol. The SMTP protocol was first defined in RFC 821 (1982), and the last update was in RFC 5321 (2008), which included extended SMTP (ESMTP).

In ordinary program development, there is often such a need to send mail, so it is inevitable to test the availability of the mail sending server. The following are the sorted commands, which are used to test the SMTP server under the command line and perform operations such as mail sending. I believe that it can play a role in enhancing the understanding of SMTP.

SMTP uses port 25 by default, we can use the telnet tool to test.

1. Connect to the SMTP server and check if it is alive.

     >telnet smtp.sina.com 25

     >Connected to mail.sina.com.

     >Escape character is'^]'.

     >220 smtp ready

     The escape character under telnet is Ctrol+]. If you want to exit, press the escape character and enter quit to return to the command line.

2. User login

     After connecting to the server, use the AUTH LOGIN command for user login (SMTP commands are not case sensitive)

     >auth login

     >334 VXNlcm5hbWU6

     >c2VydmljZUBoZWVwLmNx

     >334 UGFzc3dvcmQ6

     >xxxxxxxx

     >235 go ahead

     The 235 return code indicates that the login verification is successful and the user can proceed with subsequent operations. The user mailbox and password are Base64 encoded. This is related to the security features of the server and is a configurable item.

3. Send the email.

     After the user is authenticated, execute the following command to send the email.

     >235 #2.0.0 OK Authenticated

     >MAIL FROM: yunpan001@sina.com

     >250 sender <yunpan001@sina.com> ok

     >RCPT to: cocowool@gmail.com

     >250 recipient <cocowool@gmail.com> ok

     >DATA

     >354 go ahead

     >Subject: Hi smtp mail

     >hello mail

     >.

     >250 ok: Message 1763097690 accepted

SMTP command list

HELO

The command sent by the client to identify itself (usually with a domain name)

EHLO

Allows the server to indicate that it supports Extended Simple Mail Transfer Protocol (ESMTP) commands.

MAIL FROM

Identifies the sender of the message; used in the form of MAIL FROM:.

RCPT TO

Identifies the recipient of the message; used in the form of RCPT TO:.

TURN

Allows the client and server to exchange roles and send mail in the opposite direction without having to establish a new connection.

ATRN

ATRN (Authenticated TURN) command can choose one or more domains as parameters. If the session is authenticated, the ATRN command must be rejected.

SIZE

Provide a mechanism for the SMTP server to indicate the maximum message size supported. Compatible servers must provide a size range to indicate the maximum message size that can be accepted. The mail sent by the client should not be larger than the size indicated by the server.

ETRN

SMTP extension. The SMTP server can send ETRN to request another server to send any email it owns.

PIPELINING

Provides the ability to send a command stream without waiting for a response after each command.

CHUNKING

ESMTP command to replace DATA command. This command saves the SMTP host from continuously scanning the end of the data. It sends the BDAT command with parameters, which contains the total number of bytes of the mail. The receiving server calculates the number of bytes of the mail. If the mail size is equal to the value sent by the BDAT command, the server assumes that it has received all the mail data.

DATA

The command sent by the client to start the transmission of the mail content.

DSN

ESMTP command to enable notification of delivery status.

RSET

Invalidate the processing of the entire message and reset the buffer.

VRFY

Confirm that the mailbox can be used during mail delivery; for example, vrfy ted confirms that Ted's mailbox resides on the local server. This command is turned off by default in the Exchange implementation.

HELP

Returns the list of commands supported by the SMTP service.

QUIT

Terminate the session.

SMTP command response code

211 System status, or system help reply
214 Help message (Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user)
220 <domain> Service ready
221 <domain> Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to <forward-path> (See Section 3.4)
252 Cannot VRFY user, but will accept message and attempt delivery (See Section 3.5.3)
354 Start mail input; end with <CRLF>.<CRLF>
421 <domain> Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)
450 Requested mail action not taken: mailbox unavailable (e.g., mailbox busy or temporarily blocked for policy reasons)
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage
455 Server unable to accommodate parameters
500 Syntax error, command unrecognized (This may include errors such as command line too long)
501 Syntax error in parameters or arguments502 Command not implemented (see Section 4.2.4)

503 Bad sequence of commands
504 Command parameter not implemented
550 Requested action not taken: mailbox unavailable (e.g., mailbox not found, no access, or command rejected for policy reasons)

551 User not local; please try <forward-path> (See Section 3.4)
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed (e.g.,mailbox syntax incorrect)
554 Transaction failed (Or, in the case of a connection-opening response, "No SMTP service here")
555 MAIL FROM/RCPT TO parameters not recognized or not implemente

Related Article

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.