SMTP command line

Source: Internet
Author: User

SMTP command line

2008/08/24 10:45

Define the process of the SMTP protocol, and write a mail-sending program accordingly.

1. SMTP

SMTP (Simple Mail Transfer Protocol): A transport protocol used by e-mail messages to transfer from a client to a server or from one server to another server. SMTP is a request/response protocol in which commands and responses are based on ASCII text and end with CR and LF. The response includes a three-bit numeric code that represents the return status. SMTP listens for connection requests on TCP protocol 25 ports.

What is ESMTP

ESMTP (Extended SMTP), as the name suggests, extends SMTP as an extension of the standard SMTP protocol. It differs from the SMTP service simply by using SMTP to send letters without authenticating user accounts, and when sending a letter with ESMTP, the server asks the user for a username and password to authenticate. The message delivery process after validation is no different from the SMTP method.

2.ESMTP

ESMTP (Extended SMTP), as the name suggests, extends SMTP as an extension of the standard SMTP protocol. It differs from the SMTP service simply by using SMTP to send letters without authenticating user accounts, and when sending a letter with ESMTP, the server asks the user for a username and password to authenticate. The message delivery process after validation is no different from the SMTP method.

3.SMTP command

HELO identifies the user identity to the server. The sender can cheat, lie, but in general the server can detect.

EHLO identifies the user identity to the server. The sender can cheat, lie, but in general the server can detect.

The address specified in the MAIL from command is the sender's address

RCPT to identifies a single message recipient; multiple RCPT to; often behind mail commands.

After a single or multiple RCPT command, data indicates that all recipients of the message have identified and initialized the data transfer to CRLF. CRLF End

VRFY is used to verify that the specified user/mailbox exists or that the server often prohibits this command for security reasons

EXPN Verify that a given mailbox list exists, and that the expanded mailbox list is often disabled

Help query server What commands are supported

NOOP no action, server should respond OK

RSET reset session, current transfer canceled

QUIT End Session

4. Command line Letter Process

Microsoft Windows XP [version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\administrator>telnet

Welcome to the Microsoft Telnet Client

Escape character is ' Ctrl +] '

Microsoft Telnet>open smtp.sohu.com 25

Smtp.sohu.com ESMTP Postfix

> Helo

250-smtp.sohu.com

250-pipelining

250-size 10240000

250-vrfy

250-etrn

250-auth LOGIN

250-enhancedstatuscodes

250-8bitmime

A DSN

> Auth Login

334 Vxnlcm5hbwu6

> z2fvbwfuewlac29ods5jb20=

#Base64Encode (gaomanyi@sohu.com) = z2fvbwfuewlac29ods5jb20=

334 Ugfzc3dvcmq6

> ****************

#Base64Encode (Password) =this is a secret!

235 2.0.0 Authentication Successful

> Mail from:<gaomanyi@sohu.com>

2.1.0 Ok

RCPT to:<gamma.gao@hotmail.com>

2.1.5 Ok

Data

354 End data with <CR><LF>.<CR><LF>

Date:sun, Aug 2008 11:03:27 +0800 #随便假定个时间

From:<gaomanyi@sohu.com>

To:<gamma.gao@sohu.com> #故意写错

Subject:test for SMTP command

This is my test!

.

2.0.0 ok:queued as 75f228e8774

Quit

221 2.0.0 Bye

OK, got the letter, the situation is this:

---

Test for SMTP command #主题正确

Sender: Gaomanyi@sohu.com

Send time: August 24, 2008 11:04:43 #时间得到更正

Recipient: gamma.gao@sohu.com #收件人没更正过来, Silly x

This is my test!

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.