javax.mail.
AuthenticationFailedException错误,请高手们帮帮忙
我在servlet中写的邮件发送,老是提示javax.mail.AuthenticationFailedException错误,查了半天也没查出来是什么原因,请各位高手帮帮忙,小妹感激不尽,源码如下:
String smtpServer = request.getParameter( "txtserver ");
String emailTo = request.getParameter( "txtto ");
String fromemail = request.getParameter( "txtfrom ");
String subject = request.getParameter( "txtsubject ");
String body = request.getParameter( "txtmessage ");
try
{
Properties props = new Properties() ;
props.put( "mail.transport.protocol ", "smtp ");
props.put( "mail.smtp.auth ", "true ");
props.put( "mail.smtp.host ",smtpServer);
props.put( "mail.smtp.port ", "25 ");
Session mailsession = Session.getInstance(props);
Message msg = new MimeMessage(mailsession);
msg.setFrom(new InternetAddress(fromemail));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(emailTo));
msg.setSentDate(new Date());
msg.setSubject(subject);
msg.setText(body);
msg.saveChanges() ;
// Transport transport;
// transport = mailsession.getTransport( "smtp ");
// transport.connect((String)props.get( "smtp.163.com "), "caojunkeke ", "06240624 ");
Transport.send(msg);
msg.writeTo(System.out );
&nb