Creat
let mail = Mail(
from: MailUser(name: "My Mailer", email: "[email protected]"),
to: [MailUser(name: "John Doe", email: "[email protected]")],
subject: "Welcome to our app!",
contentType: .plain,
text: "Welcome to our app, you're all set up & stuff."
)
SMTPClient.connect(
hostname: "smtp.example.com",
ssl: .startTLS(configuration: .default)
).flatMap { client in
client.login(
user: "[email protected]",
password: "pas$w0rd"
).flatMap {
client.sendMail(mail)
}
}