SMTP & pop command details (z)

Source: Internet
Author: User

SMTP & pop command details ~
 
Author: I'm hungry

In the past, a friend asked me what should I do if I scanned the POP3 server's username and password ?? You can use software such as outlook to help others receive emails. !!!
1. The system resources they consume are too large.
2. perform various settings before use! Trouble.
3. We need to learn more.
So let's take a look at how to use Telnet to send and receive emails ~
Description.
To make it easier for you to watch, I changed some font colors.
The red word is the command we need to enter.
The brown word is the comment I added.
The other is the content returned by the server.
(I am so bitter ~~~ Ybb code is required to change the font color in this forum. It is not very convenient ~)
In addition, commands are case-insensitive (except for user passwords)
Is it because we should first explain what is SMTP and what is pop ??? Forget it. There are a lot of articles about them on the Internet, which is better than what I said.
Let's get started.
How can I receive messages without sending them ??? We use the SMTP server to send an email first.

Telnet smtp.21cn.com 25 // connect to the SMTP server. Port is 25
220 21cn.com SMTP server of AIMC 2.9.5.1; Mon, 25 Jun 2001 12:41:51 + 0800 // information returned by the server
Helo
250 21cn.com, unknown. Host <61.138.26.124> okay.
Mail from: stonegong@21cn.com // tell the server sender's email address
250 <stonegong@21cn.com>, sender OK.
RCPR Ro: stonegong@yeah.net // tell the server recipient's address.
250 user not local, will forward to <stonegong@yeah.net>. // OK! I wrote a letter below ~~
Data // tell the server that we are about to begin writing a letter ~~
Subject: Hello // subject is followed by the subject of the email. If you do not need a subject, enter the content directly.
Hi:
How are you?
. // Enter a line break and press enter to complete writing.
250 requested mail action okay, completed.
Quit // send a letter, end the conversation, and exit the SMTP server. To cancel sending, use the rset command.
221 21cn.com closing connection. // OK.

Next we will use the POP server to receive the email we just sent.

Telnet pop.yeah.net 110 // you still need to connect to. port 110 first
+ OK INCORE System Mail POP3 server ready
User stonegong // tell the server my User Name
+ OK core mail
Pass ******** // here ***** represents your password. it is displayed in plain text when you enter it. if someone is there, turn off echo first ~
+ OK 1 message (s) [457 byte (s)] // have you seen it? There is a letter ~
List // Let's take a closer look.
+ OK 1 457
1 457
. // The first 475 is the total number of bytes of all emails, and the number of bytes after 1 is the number of bytes of the first email. Because there is only one email, it is equal.
RETR 1 // return all content of the first vertex.
+ OK 457 octets
Received: From 21cn.com (unknown [61.140.60.248])
By mx1.yeah.net (postfix) with smtp id e578d1ced4cac
For <stonegong@yeah.net>; Mon, 25 Jun 2001 12:49:17 + 0800 (CST)
Received: from unknown. HOST ([61.138.26.124]) by 21cn.com (AIMC 2.9.5.1)
With smtp id jma3b36f1fc; Mon, 25 Jun 2001 12:43:27 + 0800
Subject: Hello
Hi:
How are you?
Message-ID: <20010625044917.E578D1CED4CAC@mx1.yeah.net>
Date: Mon, 25 Jun 2001 12:49:17 + 0800 (CST)
From: stonegong@21cn.com
. // Do you understand it ?? Is the one sent just now ~
Dele 1 // useless. Delete it.
+ OK core mail
List
+ OK 0 0
. // See if it's gone ~~ At this time, the email is not completely deleted. You have to wait until it is completely deleted after exiting. If you want to restore it now, run the rest n command. N indicates the number of the email.
Quit // There is nothing to do. Let's go ~.
+ OK core mail

The above is all the content of my Telnet log file. I have added comments and can certainly understand it ~~
Writing is in a hurry. There must be typos. Please understand it slowly ~ Some other commands are not mentioned. It should be enough if you want to know.

Take a look at the following and try it on your own.

If you have not understood the commands above, you can refer to the following command details.
Let's talk about the SMTP server.
HELO: <address>
The HELO command can be used to tell the SMTP server your address. <address> generally, it is the part after your e-mail address. If your electricity

The sub-mail address is:
Someone@21cn.com, then <address> is 21cn.com (I did not enter anything. Also can)
Mail from: <sender's email address>
Use the mail from command to enter the email address available when the recipient replies to you. It is generally your email address, but it can also be any character in the email address format.
Rcpt to: <recipient's email address>
The rcpt to Command requires you to enter the email address of the recipient. You can use multiple rcpt to commands to send emails to multiple recipients at the same time.

Person.
VRFY: <an email address>
The VRFY command verifies the correctness of the subsequent email address. Generally, you can use the VRFY command to verify the email address and then use the rcpt to command to send the email to the address. I did not try this command. It may be that my command is incorrect.
Data
Enter data and press enter to enter the email content. If you enter subject in the First line: <topic content> <press enter>, the recipient can see the <topic content> In the topic or subject column. Otherwise, the input part is used as the content of the body. Enter the end letter content, which can be ordered by <press enter> <. (full stop)> <press enter>.
Rset
The rset command will abort the mail sending operation and delete the input content.
Quit
Quit sends a letter, ends the conversation, and exits the SMTP server.

Let's talk about pop.
User <User Name>
Use the USER command to enter the user mailbox name, <User Name> is generally the user e-mail address @ the front part, such as the address is the someone@21cn.com, then <User Name> is someone, after the command is executed, some information is displayed and the user is prompted to enter the password.
Pass <password>
Use the PASS command to enter the user's mailbox password.
Stat
Enter the STAT command, and the server will tell you how many letters are in the mailbox.
List
Displays the number, serial number, and size of each letter.
Top N m
Displays the contents of the first m rows of the nth letter.
RETR n
The RETR command displays all the content of the nth letter.
Dele n
The DELE command is used to delete the specified nth letter.
Rest n
The rest command can restore n deleted mails.
Last
The last command displays the number of the next letter.
Noop
The Noop command does not perform any operations, and is only used to test whether the server's response is normal.
Quit
Quit exits the POP3 server and ends the mail Query Process.
**************************************** **************************************
I 've finally finished writing it. I'm so happy. I don't know if it's useful to you. Hope you have it ~~ If you have one, invite me to dinner ~~ Haha ~~
It's really not easy to write a color replacement article !!

There is a written mistake in the above section.
The following is an example:
Telnet XXXX. xxxx. xxx 25
Mail from: test@263.net (who's mailbox? I am not just here ;)
Rcpt to: test@263.net
Data
Xxx
.
Quit

If you want to view the commands supported by the server, Telnet XXXX 25 and run the Help Command.
For example:
Telnet XXX. XXX. XXX 25
Help
214-this is Sendmail version 8.9.3
214-topics:
214-Helo EHLO mail RCPT data
214-rset Noop quit help VRFY
214-EXPN verb etrn DSN
214-for more info use "Help <topic> ".
214-to report bugs in the implementation send email
214-sendmail-bugs@sendmail.org.
214-for local information send email to postmaster at your site.
214 end of help info
Haha,
That 'a all
Enjoy it :)

The POP3 command set is described in rfc1939.
My excerpt is as follows:
9. POP3 command Summary

Minimal POP3 commands:

User name valid in the authorization State
Pass string
Quit

Stat valid in the transaction state
List [MSG]
RETR msg
Dele msg
Noop
Rset
Quit

Optional POP3 commands:

APOP name digest valid in the authorization State

Top MSG n valid in the transaction state
UIDL [MSG]

POP3 replies:

+ OK
-Err

Note that with the exception of the stat, list, And UIDL commands,
The reply given by the POP3 server to any command is significant
Only to "+ OK" and "-Err". Any text occurring after this reply
May be ignored by the client.
A complete instance:
S: <waitfor connection on TCP port 110>
C: <open connection>
S: + OK POP3 Server Ready <1896.697170952@dbc.mtview.ca.us>
C: APOP mrose c4c9334bac560ecc979e58001b3e22fb
S: + OK mrose's maildrop has 2 messages (320 octets)
C: stat
S: + OK 2 320
C: List
S: + OK 2 messages (320 octets)
S: 1 120
S: 2 200
S :.
C: RETR 1
S: + OK 120 octets
S: <the POP3 server sends message 1>
S :.
C: DELE 1
S: + OK message 1 deleted
C: RETR 2
S: + OK 200 octets
S: <the POP3 server sends message 2>
S :.
C: DELE 2
S: + OK message 2 deleted
C: Quit
S: + OK Dewey POP3 server signing off (maildrop empty)
C: <close connection>
S: <wait for next connection>

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.