gpt4 book ai didi

email - grails邮件不工作

转载 作者:行者123 更新时间:2023-12-02 14:45:24 24 4
gpt4 key购买 nike

chalice 项目。我使用电子邮件插件并在尝试调用方法“sendMail”时出现异常

错误:

Caused by: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp. Failed messages: javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp; message exceptions (1) are:
Failed message 1: javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp

配置.groovy
grails {
mail {
host = "smtp.gmail.com"
port = 465
username = "mymail@gmail.com"
password = "mypass"
props = ["mail.smtp.auth":"true",
//"mail.smtp.port":"465",
//"mail.debug":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]
}
}

发送示例
sendMail {
to "fred@gmail.com"
subject "Hello Fred"
body 'How are you?'
}

我究竟做错了什么?

solution

最佳答案

错误说 Unable to locate provider for protocol: smtp .似乎您缺少 smtp 协议(protocol)的一些依赖项,这看起来很奇怪,显然您缺少 javamail (?)。因为代码对我来说似乎很好。

关于email - grails邮件不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12712092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com