您好,我正在使用 apache james 电子邮件服务器 2.3.2 通过我的 Java 应用程序发送电子邮件 我已经设置它并使用 JavaMail API 1.4。我正在尝试向 gmail/yahoo 等邮件服务器发送电子邮件。
我可以将邮件发送到本地主机上的帐户(本地运行 James 的帐户),但不能发送到外部电子邮件服务器。
我也更改了/apps/config.xml。我在 James 上有我的 MyMailet 样本。 它没有抛出任何异常。 但 mailet*.log 是这样的:
13/06/12 15:20:13 INFO James.Mailet: MyMailet#init called
13/06/12 15:20:13 INFO James.Mailet: RemoteAddrNotInNetwork: Authorized addresses: [127.0.0.1/255.255.255.255]
13/06/12 15:20:13 INFO James.Mailet: RemoteDelivery: Total number of delayTime attempts exceeds maxRetries specified. Increasing maxRetries from 1 to 6
13/06/12 15:20:17 INFO James.Mailet: MyMailet#service callednull from test@localhost
13/06/12 15:20:23 INFO James.Mailet: RemoteDelivery: Attempting delivery of Mail1339581017690-0 to host 192.168.15.186 at 192.168.15.186 for addresses [<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bbc8d3c9dec2dac88a828a8bfbdcd6dad2d795d8d4d6" rel="noreferrer noopener nofollow">[email protected]</a>]
13/06/12 15:20:23 INFO James.Mailet: RemoteDelivery: null
13/06/12 15:20:23 INFO James.Mailet: RemoteDelivery: Temporary exception delivering mail (Mail1339581017690-0:
13/06/12 15:20:23 INFO James.Mailet: RemoteDelivery: Storing message Mail1339581017690-0 into outgoing after 0 retries
dnsserver*.log 如下:
13/06/12 15:20:13 INFO dnsserver: DNS Server is: 192.168.15.3
james*.log like:
13/06/12 15:20:13 INFO James: JAMES init...
13/06/12 15:20:13 INFO James: Local host is: IISD27
13/06/12 15:20:13 INFO James: Handling mail for: 97.74.180.1
13/06/12 15:20:13 INFO James: Handling mail for: iisd27
13/06/12 15:20:13 INFO James: Handling mail for: gmail.com
13/06/12 15:20:13 INFO James: Handling mail for: 74.125.236.182
13/06/12 15:20:13 INFO James: Handling mail for: 74.125.236.181
13/06/12 15:20:13 INFO James: Handling mail for: 127.0.0.1
13/06/12 15:20:13 INFO James: Handling mail for: localhost
13/06/12 15:20:13 INFO James: Local users repository opened
13/06/12 15:20:13 INFO James: Private Repository LocalInbox opened
13/06/12 15:20:13 INFO James: JAMES ...init end
cofig.xml 如下:
<processor name="transport">
<mailet match="All" class="RemoteDelivery">
<outgoing> file://var/mail/outgoing/ </outgoing>
<gateway>192.168.15.186</gateway>//My IP addresss. Tried with smtp.gmail.com also
<gatewayPort>25</gatewayPort>
<gatewayusername>user123</gatewayusername>
<gatewayPassword>pass123</gatewayPassword>
<!-- Set the HELO/EHLO name to use when connectiong to remote SMTP-Server -->
<mail.smtp.localhost>myMailServer</mail.smtp.localhost>
</mailet>
</processor>
最佳答案
我认为由此引起的问题:
电子邮件服务器在接受任何邮件之前都会执行反向 DNS 查询。他们检查电子邮件来自的域的 IP 以及电子邮件真正来自的 IP。
如果域的 IP 和电子邮件发件人的 IP 不匹配,邮件服务器会认为该电子邮件是垃圾邮件。
这里,因为当电子邮件服务器发送反向 DNS 查询未获取 IP 并认为您的邮件是垃圾邮件时,您的域(我不知道它是什么:-?)不是有效地址。
有关更多信息,请查看:http://wiki.junkemailfilter.com/index.php/Fixing_Reverse_DNS
关于java - apache james邮件服务器发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11012841/