CMD manually send email to Sohu user by Sina User

Source: Internet
Author: User
Tags auth base64 readline sleep

It programmer development Essentials-all kinds of resources download list, history of the most IT resources, personal collection summary.
When sending a message using the SMTP protocol, the user name and password under cmd need to be base64 encoded for processing, POP3 protocol accepts the message does not need base64 encoding

Package edu.mail.util;
Import Java.io.BufferedReader;
Import java.io.IOException;
Import Java.io.InputStreamReader;
Import Sun.misc.BASE64Encoder;
/**
 * Because the user name and password entered on the cmd command line must be BASE64 encoded, the user name and password need to be BASE64 encoded 
 **/public
class Base64util {
   public static void Main (string[] args) throws IOException {
	 Base64encoder encoder = new Base64encoder ();
	 SYSTEM.OUT.PRINTLN ("Please input user name:");
	 String username = new BufferedReader (new InputStreamReader (system.in)). ReadLine ();
	 System.out.println (Encoder.encode (Username.getbytes ()));
	 SYSTEM.OUT.PRINTLN ("Please input password:");
	 String password = new BufferedReader (new InputStreamReader (system.in)). ReadLine ();
	 System.out.println (Encoder.encode (Password.getbytes ()));
	 
   }
}


take 163 mailboxes as an example →→→→→→→telnet e-mail

1. Connecting →telnet smtp.163.com 25

echo "220″

2. Application letter (casually written) →helo Vkill

echo "OK"

3. Login mode (then select General login mode) →auth Login

echo "334 Dxnlcm5hbwu6″

(Note: At this time the user and password are BASE64 encoded characters, there is no BASE64 encoded encryption device, I provide an online: http://www.yx127.com/base64.html),

4. User name →****

echo "334 Ugfzc3dvcmq6″

5. Password →****

echo "235 authentication successful" means that validation passes

6. Sender →mail from: <xxxxx@163.com >

echo "+ Mail OK"

7. Recipient →rcpt to: <xxxxx@56.com >

echo "+ Mail OK"

8. Start writing text →data

Enter the body content is OK, the body to conform to the MIME specification

Example:

From:he200377@163.com← the sender of the e-mail

to:he200377@56.com← e-Mail Recipient

Cc:he200377@56.com← recipients who receive a message sent by CC

Subject:test← the subject of the email

Version of the Mime-version:1.0←mime protocol

content-type:text/plain← Message Format Text

Hello vkill← content

When the line is entered. Enter, echo "OK" sent successfully

9. Disconnect →quit


take 163 mailbox as an example →→→→→→→telnet receive mail

Note: All Responses +ok (OK) or-err (NO)

1. Connecting →telnet pop.163.com 110

2. User name →user * * * *

3. Password →pass * * * *

4. After verifying OK, the terminal will display the following information:

+ok message (s) [72208371 byte (s)]

The number 60 indicates that there are 60 messages, and 72208371 indicates the total number of bytes in the 60 messages (that is, 72208371B)

Here are the commands you can use:

1.stat command format: Stat no parameters required

Stat command, view statistics, after execution, the POP3 server responds with a correct response, it starts with "+ok", followed by two numbers, the first is the number of messages, the second is the size of the message

2.list command format: list [n] parameter n optional, n for message number

List command to view the list of messages, you can use the list command without parameters to get the number of each message, and each message is displayed on a line, the number of previous messages is the number of the message, followed by the size of the message

3.UIDL command format: UIDL [n] parameter n optional, n for message number

UIDL command, same as list, but displays message information more detailed than list, more specific

4.RETR command format: retr n parameter n is not province, N is the message number

RETR command to view the contents of a message

5.dele command format: Dele n parameter n is not province, N is the message number

Dele command, delete the specified message (Note: The dele n command only deletes the message, only the message is deleted after the QUIT command is executed)

6.top command format: Top N m parameter n,m not province, N is the message number, M is the number of rows

The top command, which reads the number of lines of the specified message body and, if m=0, reads only the message headers of the message

7.noop command format: NoOp no parameters required

NoOp command, after the command is issued, the POP3 server does nothing and returns only a correct response "+ok"

8.quit command format: quit without parameters

Quit command, after the command is issued, Telnet disconnects from the POP3 server and the system enters the update state


use the. bat file to automatically call Telnet to send a message with 163 mailboxes as an example.

(1). Create a new Mail.bat file that contains:

   Echo Set Sh=wscript.createobject ("Wscript.Shell") >telnet_tmp.vbs Echo Wscript.Sleep >>telnet_ Tmp.vbs echo Sh. SendKeys "Open smtp.163.com 25{enter}" >>telnet_tmp.vbs echo Wscript.Sleep->>telnet_tmp.vbs echo Sh. SendKeys "Helo abc{enter}" >>telnet_tmp.vbs echo Wscript.Sleep >>telnet_tmp.vbs echo Sh. SendKeys "Auth Login{enter}" >>telnet_tmp.vbs echo Wscript.Sleep >>telnet_tmp.vbs echo Sh. SendKeys "Eggymtyzmtk={enter}" >>telnet_tmp.vbs echo Wscript.Sleep >>telnet_tmp.vbs echo Sh. SendKeys "Eglhb3hpyw8={enter}" >>telnet_tmp.vbs echo Wscript.Sleep >>telnet_tmp.vbs echo Sh. SendKeys "Mail From:<xh216319@163.com>{enter}" >>telnet_tmp.vbs echo wscript.sleep >>telnet_ Tmp.vbs echo Sh. SendKeys "Rcpt To:<351495916@qq.com>{enter}" >>telnet_tmp.vbs echo wscript.sleep >>telnet_ Tmp.vbs echo Sh. SendKeys "Data{enter}" >>telnet_tmp.vbs Echo Wscript.Sleep >>telnet_tmp.vbs echo Sh. SendKeys "Subject:!!! Write Mail Subject here!!!! {ENTER} {ENTER} ">>telnet_tmp.vbs echo Sh. SendKeys "!!! Write Mail Content here!!! {ENTER} ">>telnet_tmp.vbs echo Sh. SendKeys ". {ENTER} ">>telnet_tmp.vbs start Telnet cscript//nologo telnet_tmp.vbs del telnet_tmp.vbs

(2). Double-click Mail.bat


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.