Grails发送邮件不起作用

Grails发送邮件不起作用

本文介绍了Grails发送邮件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在我的grails应用程序中发送电子邮件。我这样做...



Config.groovy ----

  grails {
mail {
host =smtp.gmail.com
port = 465
username [email protected]
密码=*********
道具= [mail.smtp.auth:true,
mail.smtp.socketFactory.port:465,
mail.smtp.socketFactory.class:javax.net.ssl.SSLSocketFactory,
mail.smtp.socketFactory.fallback:false]

} }

和Controller

  class MailController {
def mailService

def sendmail = {
mailService.sendMail {
[email protected]
subjectHello Fred
body'你好吗?'
}
}

当我试图发送邮件时。它引发错误

$ $ p $ $ $ c $ URI
/ groovypublish / mail / sendmail

sun.security .provider.certpath.SunCertPathBuilderException
消息
无法找到要求的目标的有效证书路径

如果我从config.groovy中删除邮件道具部分。然后发送邮件后,我的页面加载无限次。



我使用localhost:8080发送邮件。我知道问题出在SSL上。但是我该如何避免使用SSL部分。



请帮助...

解决方案

我有同样的问题。进入我的病毒扫描器设置并关闭出站邮件扫描解决了这个问题。


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 = "[email protected]"
 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 "[email protected]"
    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 ...

解决方案

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

这篇关于Grails发送邮件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:34