Grails Send Mail is not working

戏子无情 提交于 2019-12-18 09:45:19

问题


I am using Mail Plugin to send email in my grails application. I am doing like this ...

Config.groovy ----

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

} }

and Controller ---

class MailController {
  def mailService

  def sendmail = {
mailService.sendMail {     
    to "example@gmail.com"     
    subject "Hello Fred"     
    body 'How are you?' 
  }
  }

When I am trying to send mail. It throwing ERROR

 URI
   /groovypublish/mail/sendmail
 Class
   sun.security.provider.certpath.SunCertPathBuilderException
 Message
   unable to find valid certification path to requested target

If I remove mail props part from my config.groovy. Then After send mail, my page loaded infinite times.

I am using localhost:8080 to send mail. I know problem is in SSL. But How can I avoid SSL part.

Please help ...


回答1:


I had the same issue. Going into my virus scanner's settings and turning off outbound mail scanning solved the issue.



来源:https://stackoverflow.com/questions/17547949/grails-send-mail-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!