VPS 从 Ktor 服务器 运行 发送电子邮件
Sending an email from Ktor server running on VPS
我正在尝试从 Ktor 应用程序发送电子邮件。
当以下代码 运行ning 在本地主机上时,它工作正常
val responseEmail = SimpleEmail()
responseEmail.hostName = "smtp.googlemail.com"
responseEmail.setSmtpPort(465)
responseEmail.setAuthenticator(DefaultAuthenticator("email@gmail.com", "pass"))
responseEmail.isSSLOnConnect = true
responseEmail.setFrom("email@gmail.com")
responseEmail.subject = "Subject"
responseEmail.setMsg("msg")
responseEmail.addTo(email)
responseEmail.send()
即使我设置了responseEmail.isSSLOnConnect = false
还是不行
但是当我 运行 VPS 上的应用程序(没有 SSL)时,我得到以下异常:
org.apache.commons.mail.EmailException: Sending the email to the following server failed: smtp.googlemail.com:465
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at org.apache.commons.mail.Email.send(Email.java:1496)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.data.modules.AccountManagementModule.forgottenPassword(AccountManagementModu>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.routes.AccountManagementKt$accountManagementRoute.invokeSuspend(Account>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.routes.AccountManagementKt$accountManagementRoute.invoke(AccountManagem>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.routes.AccountManagementKt$accountManagementRoute.invoke(AccountManagem>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:133)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing.executeResult(Routing.kt:151)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing.interceptor(Routing.kt:35)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing$Feature$install.invokeSuspend(Routing.kt:103)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing$Feature$install.invoke(Routing.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.ContentNegotiation$Feature$install.invokeSuspend(ContentNegotiation.kt:110)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.ContentNegotiation$Feature$install.invoke(ContentNegotiation.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.CallLogging$Feature$install.invokeSuspend(CallLogging.kt:139)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.CallLogging$Feature$install.invoke(CallLogging.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:133)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline.invokeSuspend(DefaultEnginePipeline>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline.invoke(DefaultEnginePipeline.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:133)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest.invokeSuspend(NettyApplicationCallHandle>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest.invoke(NettyApplicationCallHandler.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:43)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:34)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.AbstractChannelHandlerContext.access0(AbstractChannelHandlerContext.java:61)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.AbstractChannelHandlerContext.run(AbstractChannelHandlerContext.java:370)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:989)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.internal.ThreadExecutorMap.run(ThreadExecutorMap.java:74)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.EventLoopGroupProxy$Companion$create$factory.run(NettyApplicationEngine.kt:216)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at java.lang.Thread.run(Thread.java:748)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 4-yJLa62muQ6uc6fMiBsu1s3xvCVFPJMWkV7YJdO-ZDZWOwlDsYdqEJjjq0uadKzohvM1
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 56A4kwN7LQ9Sg-98Z2lpmlz7gz5ozvN6E4A-kQJ2U_Kk79iX5ziUZy503ETUA2-J>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 Please log in via your web browser and then try again.
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 Learn more at
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534 5.7.14 https://support.google.com/mail/answer/78754 ay38sm4917546wmb.3 - gsmtp
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:843)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:748)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Service.connect(Service.java:388)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Service.connect(Service.java:246)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Service.connect(Service.java:195)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Transport.send0(Transport.java:254)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Transport.send(Transport.java:124)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: ... 51 common frames omitted
我该如何解决这个问题?有没有一种方法可以在 VPS 上从 Ktor 服务器 运行ning 发送电子邮件而不使用 SSL。
我做过的事情:
我尝试使用不同的端口:465、587
我启用了不太安全的应用程序
解决方案:使用 https://accounts.google.com/DisplayUnlockCaptcha link 为您的 IP 或客户端计算机授权访问。这可以解决身份验证问题。
我正在尝试从 Ktor 应用程序发送电子邮件。 当以下代码 运行ning 在本地主机上时,它工作正常
val responseEmail = SimpleEmail()
responseEmail.hostName = "smtp.googlemail.com"
responseEmail.setSmtpPort(465)
responseEmail.setAuthenticator(DefaultAuthenticator("email@gmail.com", "pass"))
responseEmail.isSSLOnConnect = true
responseEmail.setFrom("email@gmail.com")
responseEmail.subject = "Subject"
responseEmail.setMsg("msg")
responseEmail.addTo(email)
responseEmail.send()
即使我设置了responseEmail.isSSLOnConnect = false
还是不行
但是当我 运行 VPS 上的应用程序(没有 SSL)时,我得到以下异常:
org.apache.commons.mail.EmailException: Sending the email to the following server failed: smtp.googlemail.com:465
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at org.apache.commons.mail.Email.send(Email.java:1496)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.data.modules.AccountManagementModule.forgottenPassword(AccountManagementModu>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.routes.AccountManagementKt$accountManagementRoute.invokeSuspend(Account>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.routes.AccountManagementKt$accountManagementRoute.invoke(AccountManagem>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at eu.bbsapps.forgottenfilmsapi.routes.AccountManagementKt$accountManagementRoute.invoke(AccountManagem>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:133)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing.executeResult(Routing.kt:151)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing.interceptor(Routing.kt:35)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing$Feature$install.invokeSuspend(Routing.kt:103)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.routing.Routing$Feature$install.invoke(Routing.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.ContentNegotiation$Feature$install.invokeSuspend(ContentNegotiation.kt:110)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.ContentNegotiation$Feature$install.invoke(ContentNegotiation.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.CallLogging$Feature$install.invokeSuspend(CallLogging.kt:139)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.features.CallLogging$Feature$install.invoke(CallLogging.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:133)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline.invokeSuspend(DefaultEnginePipeline>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline.invoke(DefaultEnginePipeline.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:243)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:113)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:133)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:77)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest.invokeSuspend(NettyApplicationCallHandle>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest.invoke(NettyApplicationCallHandler.kt)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:43)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:34)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.AbstractChannelHandlerContext.access0(AbstractChannelHandlerContext.java:61)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.AbstractChannelHandlerContext.run(AbstractChannelHandlerContext.java:370)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:989)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.internal.ThreadExecutorMap.run(ThreadExecutorMap.java:74)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.ktor.server.netty.EventLoopGroupProxy$Companion$create$factory.run(NettyApplicationEngine.kt:216)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at java.lang.Thread.run(Thread.java:748)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 4-yJLa62muQ6uc6fMiBsu1s3xvCVFPJMWkV7YJdO-ZDZWOwlDsYdqEJjjq0uadKzohvM1
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 56A4kwN7LQ9Sg-98Z2lpmlz7gz5ozvN6E4A-kQJ2U_Kk79iX5ziUZy503ETUA2-J>
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 Please log in via your web browser and then try again.
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534-5.7.14 Learn more at
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: 534 5.7.14 https://support.google.com/mail/answer/78754 ay38sm4917546wmb.3 - gsmtp
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:843)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:748)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Service.connect(Service.java:388)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Service.connect(Service.java:246)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Service.connect(Service.java:195)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Transport.send0(Transport.java:254)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at javax.mail.Transport.send(Transport.java:124)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
Feb 11 11:20:53 ubuntu-s-1vcpu-1gb-fra1-01 java[737632]: ... 51 common frames omitted
我该如何解决这个问题?有没有一种方法可以在 VPS 上从 Ktor 服务器 运行ning 发送电子邮件而不使用 SSL。
我做过的事情: 我尝试使用不同的端口:465、587 我启用了不太安全的应用程序
解决方案:使用 https://accounts.google.com/DisplayUnlockCaptcha link 为您的 IP 或客户端计算机授权访问。这可以解决身份验证问题。