【发布时间】:2021-06-08 19:06:20
【问题描述】:
我目前正在使用 Ktor Netty 引擎创建我的应用程序
当用户向我的服务器发送请求但一无所获时,我在文档中搜索了处理发送电子邮件的任何功能。
post("/api/v1/auth") {
// TODO send email when request is sent!
}
【问题讨论】:
标签: ktor
我目前正在使用 Ktor Netty 引擎创建我的应用程序
当用户向我的服务器发送请求但一无所获时,我在文档中搜索了处理发送电子邮件的任何功能。
post("/api/v1/auth") {
// TODO send email when request is sent!
}
【问题讨论】:
标签: ktor
在 Ktor apache-email-commons 中有一个可用的 java 依赖项
implementation("org.apache.commons:commons-email:1.5")
然后使用 SMTP 服务器,例如邮箱:
val email = SimpleEmail()
email.hostName = "smtp.googlemail.com"
email.setSmtpPort(465)
email.setAuthenticator(DefaultAuthenticator("email-account", "account-password"))
email.isSSLOnConnect = true
email.setFrom("sender-email-account")
email.subject = "email-subject"
email.setMsg("message-content")
email.addTo("target-email-address")
email.send()
【讨论】:
Ktor 中没有用于发送电子邮件的内置功能。
【讨论】: