I'm looking for sending email with VaporSMTPKit (https://github.com/Joannis/VaporSMTPKit) on a Ubuntu Server. When I'm trying to send the email with a get request, I have an "The request timed out."
Here my code :
func sendTestEmailHandler(_ req : Request) -> EventLoopFuture<String> {
let email = Mail(
from: "[email protected]",
to: [
MailUser(name: "Myself", email: "[email protected]")
],
subject: "Your new mail server!",
contentType: .plain,
text: "You've set up mail!"
)
return req.application.sendMail(email, withCredentials: .default).map {
return "Check your mail!"
}
}
Here's how I'm using the function :
routes.get("sendEmail", use : sendTestEmailHandler)
Here's how I'm setting the extension
import Foundation
import VaporSMTPKit
extension SMTPCredentials {
static var `default`: SMTPCredentials {
return SMTPCredentials(
hostname: "smtp.ionos.fr",
port: 25,
ssl: .tls(configuration: .default),
email: "[email protected]",
// a changer sur le serveur
password: "XXXX"
)
}
}
I'm using SIDT for sending a get request like
http://XXXX/sendEmail
I'm using an email from another website (not from the server). The 25 ports are open on the website and on the server.
If you know how to deal with this problem, let me know. Thanks you very much. When I'm trying to change to another port or to POP3, I have a warning alert so I don't think it's the problem.
Thank you, Nick, for your assistance.
I previously attempted to use ssl: .tls(configuration: .default), but the issue was resolved when I modified it to ssl: .startTLS(configuration: .default).
I appreciate everyone's help Emmanuel