我想从Grails应用程序发送邮件,但没有任何成功。Grails Mail插件不工作
我使用Gmail和其他SMTP服务器(不使用SSL),但是出现同样的错误:
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?. Failed messages: javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?; message exceptions (1) are: Failed message 1: javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
我使用Config.groovy中(例如为gmail):
grails.mail.host = "smtp.gmail.com" grails.mail.from = "[email protected]" grails.mail.port = "465" grails.mail.ssl = "on" grails.mail.username = "[email protected]" grails.mail.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"]
编辑:我做了一个简单的应用程序,只有邮件插件和控制器和Javid Jamae发布的配置工作(第三个答案,我也认为其他应该工作)。
但即使我只是复制粘贴相同的配置和相同的发送邮件代码,在我的主项目它仍然给我同样的例外!我认为这可能是由Nimble插件引起的(Mail插件是由它安装的)。 我的配置是:
Grails的版本:1.3.4
Groovy的 版本:1.7.4
JVM版本:1.6.0_21
jQuery的 - 1.4.2.5
邮件 - 0.9
四郎 - 1.0.1
灵活 - 0.4快照
最后编辑: 我解决了这个问题:看来,我有灵活的插件使用相同的设置也,在NimbleConfig.groovy - >邮件{...(必须有“from = ...”)}。
愚蠢的问题,但在它上面花了很多时间。
我正在关闭此主题。我没有找到解决方案,但我发现问题太老了,没有人回答。 – cripox 2010-09-11 11:00:13
这适用于我。 – 2011-04-17 15:56:52
这不适合我。我得到这个错误 - '无法找到有效的证书路径到请求的目标'。请检查我的问题[这里](http://stackoverflow.com/questions/17547949/grails-send-mail-is-not-working).. – 2013-07-15 04:53:57