Java mail, java mail
Email sending Applet:
Import java. util. properties; import java. util. export; import javax. mail. session; import javax. mail. transport; import javax. mail. internet. internetAddress; import javax. mail. internet. mimeMessage; import javax. mail. internet. mimeMessage. recipientType; public class Main {// sender private static String user = ""; // password private static String pass = ""; // recipient private static String to = ""; // topic private static String subject = ""; // content private static String content = ""; // initialize the session information private static Properties props = new Properties (); static {// mail sending protocol props. setProperty ("mail. transport. protocol "," smtp "); // SMTP Mail Server props. setProperty ("mail. smtp. host "," smtp.263.net "); // SMTP Mail Server default port props. setProperty ("mail. smtp. port "," 25 ");} public static void main (String [] args) throws Exception {sendTextEmail ();} public static void sendTextEmail () throws Exception {// The input retrieves the response info = new response (System. in); System. out. println ("account:"); user = info. nextLine (); System. out. println ("Password:"); pass = info. nextLine (); System. out. println ("recipient email:"); to = info. nextLine (); System. out. println ("topic:"); subject = info. nextLine (); System. out. println ("email content:"); content = info. nextLine (); // creates a Session session = Session. getDefaultInstance (props); // create MimeMessage message = new MimeMessage (session); // set the sender message. setFrom (new InternetAddress (user); // sets the mail subject message. setSubject (subject); // set the recipient message. setRecipient (RecipientType. TO, new InternetAddress (to); // sets the message content. setText (content); // Save the message. saveChanges (); // obtain Transport = session. getTransport (); transport. connect (user, pass); // send the email transport. sendMessage (message, message. getAllRecipients (); transport. close ();}}