Posted By:
Lee_Juan
Posted On:
Wednesday, September 11, 2002 12:13 PM
Can someone please look at my jsp code here that sends an e-mail. Sometimes it works. Sometimes it doesn't and output EOF on socket error: javax.mail.AuthenticationFailedException: EOF on socket Properties props = new Properties(); props.put("mail.smtp.host", "mysmtp"); Session s = Session.getInstance(props,null); Store store = s.getStore("pop3"); store.connect(mypop3, username, password); MimeMessage message = new MimeMessage(s); InternetAddress from = new InternetAddress("myemail"); message.setFrom(from); String toAddress = request.getParameter("to");
More>>
Can someone please look at my jsp code here that sends an e-mail. Sometimes it works. Sometimes it doesn't and output EOF on socket error:
javax.mail.AuthenticationFailedException: EOF on socket
Properties props = new Properties();
props.put("mail.smtp.host", "mysmtp");
Session s = Session.getInstance(props,null);
Store store = s.getStore("pop3");
store.connect(mypop3, username, password);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress("myemail");
message.setFrom(from);
String toAddress = request.getParameter("to");
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient(Message.RecipientType.TO, to);
String subject = request.getParameter("subject");
message.setSubject(subject);
String text = request.getParameter("text");
message.setText(text);
Transport.send(message);
store.close();
Can someone tell me whats wrong with it?
I cannot use the getTransport function because it produce error when compiled on jsp as javax.servlet don't support that method. So I have to use the Store method to verify my username and password. A million thanks.
<<Less