pub struct SmtpClient { /* private fields */ }Expand description
SMTP client — wraps lettre for sending emails.
Thread-safe via Arc<SmtpTransport>. Created once during kernel init
from [email] config and stored in EmailApi.
Implementations§
Source§impl SmtpClient
impl SmtpClient
Sourcepub fn from_config(config: &EmailConfig, password: &str) -> Result<Self>
pub fn from_config(config: &EmailConfig, password: &str) -> Result<Self>
Build an SmtpClient from config and credentials.
password is the SMTP auth password (app password for Gmail).
It is never stored beyond the lettre transport internals.
Sourcepub async fn send(
&self,
_to: &str,
subject: &str,
html: &str,
text: Option<&str>,
) -> Result<SendReceipt>
pub async fn send( &self, _to: &str, subject: &str, html: &str, text: Option<&str>, ) -> Result<SendReceipt>
Send an email.
In v1, to is ignored — always sends to default_to (the user’s own email).
If text is None, a minimal plain-text fallback is generated from the subject.
Sourcepub async fn test_connection(&self) -> Result<()>
pub async fn test_connection(&self) -> Result<()>
Test the SMTP connection by sending a simple test email.
Sourcepub fn default_to(&self) -> &str
pub fn default_to(&self) -> &str
The default “to” address (user’s own email, same as from in v1).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SmtpClient
impl !UnwindSafe for SmtpClient
impl Freeze for SmtpClient
impl Send for SmtpClient
impl Sync for SmtpClient
impl Unpin for SmtpClient
impl UnsafeUnpin for SmtpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more