While I was goggling I got the below link and that says "Username and password is generally not needed to send e-mail although your ISP may still require it to prevent spam from going through its systems."
http://www.vipan.com/htdocs/javamail.html
While I was trying without username and password am getting below exception. Please assist me how to send mail with out username and password
java.net.ConnectException: Connection timed out (errno:238)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
at javax.mail.Service.connect(Service.java:288)
at javax.mail.Service.connect(Service.java:169)
at javax.mail.Service.connect(Service.java:118)
at com.iflex.pdfmailutilities.mail.EmailSender.sendEmail(EmailSender.java:140)
at com.iflex.pdfmailutilities.mail.EmailSender.sendMail(EmailSender.java:179)
at com.iflex.pdfmailutilities.mail.EmailSender.main(EmailSender.java:164)
Caused by: java.net.ConnectException: Connection timed out (errno:238)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:462)
at java.net.Socket.connect(Socket.java:412)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)