Indent-kr-i4 Simplemail.java can be used, but it's too easy.
Astyle, this is a good tool.
http://astyle.sourceforge.net/
Astyle--style=java--style=allman-f Simplemail.java
Java code to send mail!! Pro-Test can be used
Import Javax.mail.*;import Javax.mail.internet.*;import Javax.mail.authenticator;import Javax.mail.passwordauthentication;import Java.util.properties;public class simplemail{private static final String SMT P_host_name = "smtp.host.com"; private static final String Smtp_auth_user = "[email protected]"; private static final String smtp_auth_pwd = "password"; public static void Main (String[]args) throws Exception {new Simplemail (). Test (); } public void Test () throws Exception {Properties props = new Properties (); Props.put ("Mail.transport.protocol", "SMTP"); Props.put ("Mail.smtp.host", smtp_host_name); Props.put ("Mail.smtp.auth", "true"); Authenticator auth = new Smtpauthenticator (); Session mailsession = session.getdefaultinstance (props, auth); Uncomment for debugging infos to stdout//Mailsession.setdebug (TRUE); Transport Transport = Mailsession.gettransport (); MimemeSsage message = new MimeMessage (mailsession); Message.setcontent ("This is a test", "Text/plain"); Message.setfrom (New InternetAddress ("xxx.com")); Message.addrecipient (Message.RecipientType.TO, New InternetAddress ("[email protected]")); Transport.connect (); Transport.sendmessage (Message, message.getrecipients (Message.RecipientType.TO)); Transport.close (); } private class Smtpauthenticator extends Javax.mail.Authenticator {public passwordauthentication GETP Asswordauthentication () {String username = Smtp_auth_user; String password = smtp_auth_pwd; return new passwordauthentication (username, password); } }}
Code formatting Tools under Ubuntu