发送带有Tomcat的smtp电子邮件的邮件和这个代码在JSP使用的类上:
Authenticator authenticator = new Authenticator();
// Create some properties and get the default Session.
Properties props = System.getProperties();
props.put("mail.smtp.auth", true);
props.put("mail.smtp.host", "host");
props.put("mail.smtp.port", "26");
// Get the default Session object.
Session session = Session.getInstance(props,authenticator);
在localhost和命令行上运行tomcat之外的相同代码,电子邮件发送没有问题,但是Tomcat我有这个例外:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 <some@email.com>... Relaying denied. IP name possibly forged [xxx.xxx.xxx.xxx]
有没有人提示为什么tomcat没有发送电子邮件?