Java mail
We have used many emails, QQ, 163, Netease, etc.
1、 SMTP protocol should be followed when sending e-mail, and POP3 protocol should be followed when receiving e-mail
2、 Process of sending e-mail
Suppose you use QQ mail
Write e-mail -- > click "send" -- > QQ e-mail server receives e-mail (if QQ is used to send e-mail to Netease e-mail, next, QQ e-mail server forwards it to Netease e-mail server)
3、 Send mail using SMTP
After being familiar with SMTP protocol, you can send e-mail without any software.
For example, we use QQ email to send email to our friends
Step 1: connect to QQ's mail server:
QQ's mail server is: SMTP qq. COM port is 25. You can see this by clicking "help" in the mailbox.
At the command line, enter telnet SMTP qq. Com 25, the effect is as follows, successfully connected to the server
Step 2: say hello to the server
Continue to enter: Ehlo Zhangsan in the command window. The effect is as follows:
Step 3: log in to the mail server
Continue to enter: auth login. The effect is as follows:
Step 4: enter user name and password
For example, your email address is 11111111@qq.com Then your username is 11111111
Enter user name enter
Enter the password and press enter to see whether the returned message is successful
Note: base64encoder code is required for user name and password here. The coded code is as follows. Put the user name and password in and run to get the transcoded string
It's best to use the program to change your user name and password in advance, then put it in Notepad and paste it into the command window, because too slow input will lead to loss of connection.
Step 5: tell the server, sender and recipient
Sender: the email you just logged in to, namely: 11111111@qq.com
To: is your friend's email, such as 222@qq.com
Continue to enter the command: mail from:< 11111111@qq.com >Enter
Continue to enter the command: RCPT TO:< 222@qq.com >Enter
Step 6: start writing email
You can start writing mail only after you have successfully logged in in the previous step
1. Enter data on the command line and enter
2. Enter email content
For example:
from:< 111111111@qq.com > to:< 222@qq.com Subject: Holiday Notice
The company is scheduled to have a three-day holiday on XXX. enter
Note: here (> to:< 222@qq.comsubject : Holiday Notice) can not be written, that is, only the following words are written. Give it a try and you'll see the difference.
3. Tell the server that the mail is finished and can be sent
Enter "." Then enter
Done.