3

I am using Apache mail to send emails from my Gmail account, as follows:

       HtmlEmail email = new HtmlEmail();
        email.setHostName("smtp.gmail.com");
        email.setSmtpPort(465);
        email.setAuthenticator(new DefaultAuthenticator("mygmailaccount@mydomain.com", "mypassword"));
        email.setSSLOnConnect(true);
        email.setFrom("no-reply",
                "appName");

    @Async
    public void send(HtmlEmail email) throws EmailException {
        email.send();
    }

I am using spring framework to run tasks asynchronously.

This works fine on my local machine, but when trying to run the code from CloudBees, I don't get the email in my inbox although I didn't find anything unusual in the debugs.

Can anyone please advise about this issue ?

4

2 回答 2

3

没有网络设置阻止从 CloudBees 到任何服务的出站连接。但是,出于垃圾邮件的原因,谷歌可能会警惕来自亚马逊托管 IP 的流量。亚马逊也对垃圾邮件保持警惕,并且可以控制 SMTP 服务。

我希望它是其中之一,您是否查看过谷歌文档,了解为什么这可能会停止工作?

于 2013-07-22T09:53:01.150 回答
3

问题出在我的代码中,特别是在@Async我替换它的注释中@Asynchronous,一切正常。

于 2013-07-23T18:30:51.710 回答