tags:

views:

89

answers:

1

I'm using Grails Mail plugin and trying to send email and keep getting:

Error 500: Executing action [sendInvite] of controller [RegisterController] caused exception: Failed messages: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550 must be authenticated

I'm properly following the instructions at: http://www.grails.org/Mail+plugin

+1  A: 

The mail server is returning an error when you try to send out the mail. 550 is a generic SMTP failure code; in this case it looks like you are missing a username and password. Some SMTP servers to not require authentication but most do, especially if they're publicly available on the internet. It's also possible that your SMTP server requires an SSL connection and you're connecting with an unsecured socket.

The example config for gmail shows how to set all the mail server authentication options in Config.groovy:

grails {
    mail {
        host = "smtp.gmail.com"
        port = 465
        username = "[email protected]"
        password = "yourpassword"
        props = ["mail.smtp.auth":"true",         
              "mail.smtp.socketFactory.port":"465",
              "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
              "mail.smtp.socketFactory.fallback":"false"]
    }
}

Add "mail.debug": "true" to props to turn on JavaMail debugging to get a better picture of what is happening before the failure.

ataylor