小弟有如下的发信的完整代码片段:
Properties props = new Properties();
props.put("mail.smtp.host", "210.192.103.170");
Session s = Session.getInstance(props);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress("webmaster@yqgjj.com");
message.setFrom(from);
InternetAddress to = new InternetAddress("networkshine@163.com");
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("Test from JavaMail");
message.setText("Hello from JavaMail");
Transport.send(message);
out.println("ok");
1。 注意:此smtp暂时不须用身份验证。
2。 运行此程序,则出现下面的错误:
org.apache.jasper.JasperException: Sending failed;
nested exception is:
class javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
class javax.mail.SendFailedException: 553-This target address is not our MX service
553-client, nor Your envelope sender is user
553-that is allowed to openly use us to relay
553-to any arbitary address throw us.
553 We don't accept this recipient.
3。
但是,用这个帐号给他自己发信却是可以的。
及其给所有的@yqgjj.com发信也是可以的。
4。当我用其它的smtp的时候(如:sina。当然,此时是要身分验证的。我也加上了:参见我的
另一篇帖子javamail)。
可以成功发信给任何的信箱。但是,换了这个smtp的时候就不行了。
出现了上面的错误。
5。 同时我在outlook express中设置了此smtp的账号,可以成功发信和收信。
6。 同时,写了一段php的发信程序,用的也是上面的这上发信帐号。可以成功发送任意 的信件。
7。 我实在判断不出来这是什么错误了,请大侠们帮忙解决一下。