Apache James是最好用的开源java邮件服务器之一,在配置smtp服务过程中,有些步骤不对的话邮件就发送不出去。
0.打开james-2.2.0appsjamesSAR-INFconfig.xml文件
1.transport
注释掉
<!--mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
<processor> relay-denied </processor>
<notice>550 - Requested action not taken: relaying denied</notice>
</mailet-->
使用smtp认证方式
2.dnsserver
输入服务器的DNS IP,例如:
<server>202.96.134.133</server>
<server>202.96.128.110</server>
<server>202.96.128.68</server>
设置autodiscover为false
如果设置为自动探测的话,在我的机器上会报错:
James.Mailet: RemoteDelivery: Temporary exception delivering mail (Mail1098776398187-0-to-somedomain.com: javax.mail.MessagingException: There are no DNS entries for the hostname somedomain.com. I cannot determine where to send this message.
at org.apache.james.transport.mailets.RemoteDelivery.deliver(RemoteDelivery.java:398)
at org.apache.james.transport.mailets.RemoteDelivery.run(RemoteDelivery.java:912)
at java.lang.Thread.run(Thread.java:534)
3.修改root口令。account login="root" password="mypassword"
4.smtpserver
打开smtp认证
<authRequired>true</authRequired>
5.重新启动James
6.telnet server-name 4555,增加用户
7.就可以用outlook等发送邮件了。