查看: 961|回复: 2
|
在WINXP+IIS/SMTP+Tomcat上send email..
[复制链接]
|
|
出现
javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for 456@yahoo.com
有谁知道是什么原因吗?
<%@ page import=" javax.mail.*, javax.mail.internet.*, javax.activation.*, java.util.*"%>
<%
try{
Properties props = new Properties();
Session sendMailSession;
Transport transport;
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "localhost");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress("123@yahoo.com"));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("456@yahoo.com"));
newMessage.setSubject("subject send mail");
newMessage.setText("test send content");
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
%>
<P>Your mail has been sent.</P>
<%
} catch(MessagingException m)
{
out.println(m.toString());
}
%>
[ 本帖最后由 jasonmun 于 2-9-2006 03:40 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 2-9-2006 04:30 PM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 2-9-2006 05:05 PM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|