Apache James问题小记(apachejames安装机器以外的主机发邮件)

  一直以来都是把tomcat和apache james 放在一台机器上,发送邮件来完成注册,通知等功能。

  今天把tomcat部署在151的主机上,James部署在105的主机,151主机用105上面的james发邮件,结果未成功,提示javax.mail.AuthenticationFailedException,检查了用户名和密码,都是正确的。然后就开始检查配置文件,<servername></servername>是正确的,再往下看,<smtpserver></smtpserver>中有一个配置项<authRequired>true</authRequired>,以前都是按照网上的方法去配置,测试可用。

  再往下看,有这么一段说明:

If you use SMTP AUTH, addresses that match those specified here will
be permitted to relay without SMTP AUTH. If you do not use SMTP
AUTH, and you specify addreses here, then only addresses that match
those specified will be permitted to relay.

Addresses may be specified as a an IP address or domain name, with an
optional netmask, e.g.,

127.*, 127.0.0.0/8, 127.0.0.0/255.0.0.0, and localhost/8 are all the same

See also the RemoteAddrNotInNetwork matcher in the transport processor.
You would generally use one OR the other approach.

啊哈,就是这了。SMTP验证,原来是这里出错了,于是在

<authorizedAddresses>127.0.0.0/8</authorizedAddresses>

中添加了151主机的IP,重新发送,走一个,去邮箱查看,收到了!

原文地址:https://www.cnblogs.com/coderdu/p/2873235.html