feat: add mailsend

This commit is contained in:
2022-06-06 00:05:36 +08:00
parent fbfe58c0e7
commit d181d970de
3 changed files with 823 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
use mail_send::mail_builder::MessageBuilder;
use mail_send::Transport;
// https://github.com/stalwartlabs/mail-send
fn main() {
// Build a simple multipart message
let message = MessageBuilder::new()
.from(("John Doe", "john@example.com"))
.to(vec![
("Jane Doe", "jane@example.com"),
])
.subject("Hi!")
.html_body("<h1>Hello, world!</h1>")
.text_body("Hello world!");
// Send the message
Transport::new("unsecured.example.com")
.port(25)
.connect()
.await
.unwrap()
.send(message)
.await
.unwrap();
}