Grails 发送邮件不起作用 [英] Grails Send Mail is not working

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

问题描述

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

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

Config.groovy ----

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"]

} }

和控制器---

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

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

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

我使用 localhost:8080 发送邮件.我知道问题出在 SSL 中.但是我怎样才能避免 SSL 部分.

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

请帮忙...

推荐答案

我遇到了同样的问题.进入我的病毒扫描程序的设置并关闭出站邮件扫描解决了这个问题.

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆