feat: add mailsend
This commit is contained in:
25
__network/mailsend/src/main.rs
Normal file
25
__network/mailsend/src/main.rs
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user