嗨,我正在使用 apache james 电子邮件服务器 2.3.2 通过我的 Java 应用程序发送电子邮件,我已经设置它并使用 JavaMail API 1.4。我正在尝试向 gmail/yahoo 等邮件服务器发送电子邮件。
我可以将邮件发送到 localhost 上的帐户(本地运行的 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 [shreyas1910@gmail.com]
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>