1. e-Mail protocol
e-mail is transmitted over the network as well as Web pages that require compliance with specific protocols, and commonly used e-mail protocols include Smtp,pop3,imap.
The SMTP protocol is used only for the creation and sending of messages, and all of this is only related to the SMTP protocol. SMTP is the short name of Simple Mail Transfer Protocol, which is simply the message Transfer Protocol.
2. JavaMail
Java official also provides the Java class library which encapsulates the e-mail protocol, is javamail, but does not include in the standard JDK, needs us to go to Java or the Oracle official website to download.
:
Https://java.net/projects/javamail/pages/Home or http://www.oracle.com/technetwork/java/javamail/index.html
Third, the premise of sending mail
To send a message, you first need to have a mailbox account and password, and the email account must have the SMTP service turned on.
Take 163 mailbox As an example, after you log on to a mailbox in a browser Web page, you can usually open it in the Settings tab of the mailbox and note the SMTP server address of the mailbox:
Four. Create and send an email
Message creation steps:
Create a Mail object (mimemessage);
Set sender, recipient, optional Add multiple recipients, cc person, secret send person;
Set the subject (title) of the message;
Set the body of the message (content, attachments);
Set the sending time of the display;
Save to Local.
Use JavaMail to send mail in Java