apache詹姆斯邮件服务器发送电子邮件

时间:2012-06-13 10:21:36

标签: java apache james

您好我正在使用apache james email server 2.3.2来发送我的Java应用程序的电子邮件 我已经设置它并使用JavaMail API 1.4。我想把电子邮件发送到gmail / yahoo等邮件服务器。

我可以通过localhost(在本地运行James的帐户)上发送邮件,但不能向外部电子邮件服务器发送邮件。

我也改变了/apps/config.xml。我在詹姆斯上有我的样本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>

1 个答案:

答案 0 :(得分:2)

我认为由此造成的问题:

在接受任何邮件之前通过电子邮件服务器执行反向DNS查询。他们检查电子邮件来自的IP域以及电子邮件真正来自的IP。

如果域名和电子邮件发件人的IP不匹配,邮件服务器会认为该邮件是垃圾邮件或垃圾邮件。

这里,因为您的域名(我不知道它是什么: - ?)不是有效的地址,当电子邮件服务器发送反向DNS查询时没有获得IP并认为您的邮件是垃圾邮件或垃圾邮件。

有关详情,请查看:http://wiki.junkemailfilter.com/index.php/Fixing_Reverse_DNS