グレイルズプロジェクト。メールプラグインを使用していて、メソッド '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
config.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?'
}
私は何を間違っていますか?