关于JAVAMAIL发邮件问题! 救助啦^^

java6 java6 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

请先看一下此发送JAVAMAIL的JSP程序:

<%@ page import= " javax.mail.*, javax.mail.internet.*, javax.activation.*, java.util.*"%>

<html>
<head>
<title> JavaMail 电子邮件发送系统 </title></head>
<body>
<%
try{
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "smtp.sohu.com");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress(request.getParameter("from")));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(request.getParameter("to")));
newMessage.setSubject(request.getParameter("subject"));
newMessage.setSentDate(new Date());
newMessage.setText(request.getParameter("text"));
transport = sendMailSession.getTransport("smtp");
transport.connect("smtp.sohu.com","wang76_cn","764688");
transport.send(newMessage);
%>
<p> 你的邮件已发送,请返回。 <p>
<%
}
catch(MessagingException m)
{
out.println(m.toString());
}
%>
</body>
</html>

我从表单中提交from: wang_cn@sohu.com
to: whsu@sina.com
怎么出错呀:

javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: 505 Client was not authenticated
...全文
评论 2
收藏 已收藏
分享
返回顶部
java6
Web 开发 81,108 成员 341,721 内容