I tested it today. Using Java code to send a limited number of services is very simple. Direct Post code:
Importcom.sun.mail.util.MailSSLSocketFactory;ImportJavax.mail.*;Importjavax.mail.internet.InternetAddress;ImportJavax.mail.internet.MimeMessage;Importjava.security.GeneralSecurityException;Importjava.util.Date;Importjava.util.Properties; Public classMain { Public Static voidMain (string[] args)throwsmessagingexception, generalsecurityexception {Properties props=NewProperties (); //turn on debug debuggingProps.setproperty ("Mail.debug", "true"); //The sending server requires authenticationProps.setproperty ("Mail.smtp.auth", "true"); //set the mail server host nameProps.setproperty ("Mail.host", "smtp.163.com"); //props.setproperty ("Mail.port", "465"); //Send mail Agreement nameProps.setproperty ("Mail.transport.protocol", "SMTP"); Mailsslsocketfactory SF=Newmailsslsocketfactory (); Sf.settrustallhosts (true); Props.put ("Mail.smtp.ssl.enable", "true"); Props.put ("Mail.smtp.ssl.socketFactory", SF); Session Session=session.getinstance (props); Message msg=NewMimeMessage (session); Msg.setsubject ("Seenews Error"); StringBuilder Builder=NewStringBuilder (); Builder.append ("url =" + "http://blog.csdn.net/never_cxb/article/details/50524571"); Builder.append ("\ nthe page crawler error"); Builder.append ("\ n Time" +NewDate (). GetTime ()); Msg.settext (Builder.tostring ()); Msg.setfrom (NewInternetAddress ("[Email protected]")); Transport Transport=Session.gettransport (); Transport.connect ("Smtp.163.com", "[email protected]", "* * your own e-mail address * *"); Transport.sendmessage (MSG,NewAddress[] {NewInternetAddress ("[Email protected]") }); Transport.close (); }}
This should be OK. Yes, before you have to download the appropriate JAR packages: Activation.jar and Mail.jar.
Pure Java implementation of mail delivery service (pro-test easy to use)