std::net::smtpSMTP client for sending email.
Provides functions for connecting to an SMTP server and sending plain-text or HTML email messages.
import std::net::smtp;
fn main() {
smtp.send(
"smtp.example.com",
587,
"user",
"pass",
"from@example.com",
"to@example.com",
"Subject",
"Body",
);
}
connectConnect to an SMTP server using STARTTLS.
let conn = smtp.connect("smtp.example.com", 587, "user", "pass");
connect_tlsConnect to an SMTP server using implicit TLS.
let conn = smtp.connect_tls("smtp.example.com", 465, "user", "pass");
sendConnect with the same STARTTLS path as connect(...), send one plain-text
email, and close the connection.
Use connect_tls(...) + Conn.send(...) when you need implicit TLS or want
to reuse a connection for multiple messages.
try_sendConnect with the same STARTTLS path as connect(...), send one plain-text
email, and close the connection.
send_htmlConnect with the same STARTTLS path as connect(...), send one HTML email,
and close the connection.
Use connect_tls(...) + Conn.send_html(...) when you need implicit TLS or
want to reuse a connection for multiple messages.
try_send_htmlConnect with the same STARTTLS path as connect(...), send one HTML email,
and close the connection.
ConnAn open SMTP connection handle.
Created by calling smtp.connect(...) or smtp.connect_tls(...).
Use send() or send_html() to deliver messages.
ConnMethodsMethods available on an SMTP Conn.
Send a plain-text email. Return 0 on success.
Send a plain-text email.
Send an HTML email. Return 0 on success.
Send an HTML email.
Close the SMTP connection.