1

I'm trying to send mail from my Grails app with mail plugin. It worked in the development enviroment and for the default settings for gmail smtp. I have now deployed app on Windows server running Tomcat 7 and trying to send mail via Exchange. I am getting this error:

These are mail properties in config.groovy:

grails {
mail {
  host = "mail.something.com"
  port = 25
  username = "app@something.com"
  password = "xxx"
  props = ["mail.smtp.auth":"true",
           "mail.smtp.socketFactory.port":"25",
           "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
           "mail.smtp.socketFactory.fallback":"false"]
}

}

javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client

at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:590)

at javax.mail.Service.connect(Service.java:291)

at grails.plugin.mail.MailMessageBuilder.sendMessage(MailMessageBuilder.groovy:102)

at grails.plugin.mail.MailMessageBuilder$sendMessage.call(Unknown Source)

at grails.plugin.mail.MailService.sendMail(MailService.groovy:39)

at grails.plugin.mail.MailService$sendMail.call(Unknown Source)

at org.helpdesk.RequestController$_closure12.doCall(RequestController.groovy:240)

at org.helpdesk.RequestController$_closure12.doCall(RequestController.groovy)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

What should I do? Thanks.

drago
  • 1,207
  • 4
  • 24
  • 45

2 Answers2

3

It is clearly stated what's wrong:

javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client

Your Gmail SMTP settings won't work with Exchange server. You need to change settings. Just search for it. Here is one question involving Java Mail and Exchange server: JavaMail Exchange Authentication and you might be interested in this topic in Java Mail FAQ: http://www.oracle.com/technetwork/java/faq-135477.html#Exchange-login .

Community
  • 1
  • 1
Tomasz Kalkosiński
  • 3,673
  • 1
  • 19
  • 25
  • As I said I'm using grails mail plugin. Not Java Mail. So your example does not help me. If u can please be more specific. – drago Dec 12 '11 at 13:18
  • 1
    @drago - The Mail plugin uses JavaMail; the configuration you specify in `Config.groovy` is essentially a configuration for JavaMail. This answer should be helpful to you. – Rob Hruska Dec 12 '11 at 13:40
  • 1
    Thank you @Rob for clarification. drago - you should read docs and search Google and StackOverflow more by yourself than asking for instant and complete answers. Your comment clearly shows that haven't even check links I've provided. – Tomasz Kalkosiński Dec 12 '11 at 14:06
  • @TomaszKalkosiński I did check your links but I felt I need to explore grails mail plugin and then spring and java mail so it felt like an overkill. This [link](http://simonpalmer.com/2010/03/12/really-simple-mail-service-for-authsmtp-in-grails/) in combination with your link helped me inderstand what I need to do. – drago Dec 12 '11 at 14:23
-2

These settings are for Gmail (just change username/password):

grails.mail.from = "First Last <some_name@gmail.com>"
grails.mail.host = "smtp.gmail.com"
grails.mail.port = "465"
grails.mail.username = "some_name@gmail.com"
grails.mail.password = "xxx-password-xxx"
grails.mail.props = ["mail.smtp.auth": "true",
        "mail.smtp.socketFactory.port": "465",
        "mail.smtp.socketFactory.class": "javax.net.ssl.SSLSocketFactory",
        "mail.smtp.socketFactory.fallback": "false",
        "mail.smtp.starttls.enable": "true",
        "mail.debug": "true"]
vmorarian
  • 62
  • 1
  • 2
  • The OP wants to send mail via Exchange, not Gmail, and mentioned that their Gmail settings were already working. – Rob Hruska Dec 12 '11 at 14:50