This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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."
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)
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
7
posted
0
"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."
That was true in the days of dial-up, where the ISP's mail server knew that the client was an authenticated user. These days -with connections made over TCP/IP from potentially anywhere- authentication is almost always required.
But the error message sounds more like a general connection problem than something related to authentictaion. Can you telnet to port 25 of the SMTP server?
I got this code using the link earlier I possted. But this never used userid and password. Is there any other way to connect to SMTP with out userid and password
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
7
posted
0
Times have changed; you need to get used to using authentication with SMTP. The JavaMail tutorial linked from the JavaRanch JEE FAQ has code samples for that.
Meet Gaurav
Ranch Hand
Joined: Oct 08, 2008
Posts: 492
posted
0
How to identify whether the STMP server requires authentication or not. I heard some open SMTP servers are there and they dont require any user id and password for sending email.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35247
7
posted
0
No reputable ISP or hosting company runs open SMTP relays any more these day. They'd be blacklisted everywhere fast.
The error message you get when trying to connect to an SMTP without authentication will indicate that it is an authentication problem; so that's a clue :-)
Meet Gaurav
Ranch Hand
Joined: Oct 08, 2008
Posts: 492
posted
0
But when I tried with the same program with authentication I mean simply pass the user id and password to connect and its working fine. If i tried to connect directly without userid and password am getting this below exception. Don't know wats happening
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)
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.