在Grails应用程序中使用Mailjet API发送邮件

时间:2014-04-10 06:29:43

标签: java email grails configuration mailjet

我想在Grails应用程序中集成Mailjet API来发送邮件,我已经使用ASYNC邮件API以grails方式发送邮件,在这个api中,我需要在config.groovy中提供配置参数。现在我使用Mailjet发送邮件,所以我需要在config.groovy中提供Mailjet SMTP设置,所以我给出如下:

grails {
       mail {
         host = "in.mailjet.com"
         port = 465
         username = "xxx@gmail.com"
         password = "xxx"
         props = ["mail.smtp.host": "in.mailjet.com",
                  "mail.smtp.socketFactory.port": "465",
                  "mail.smtp.socketFactory.class": "javax.net.ssl.SSLSocketFactory",
                  "mail.smtp.auth":"true",                     
                  "mail.smtp.port": "465",
                  "mail.smtp.user": "API key of mailjet",
                  "mail.smtp.password": "secret key of mailjet"]
       }
    } 

以下是使用java code

发送邮件的示例

我做错了什么?

1 个答案:

答案 0 :(得分:1)

用户名和密码必须包含您的api密钥和api密钥,而不是凭据 您用来登录网站。 使用mail.smtp.host作为属性是多余的,不需要。