pub struct EmailConfig {
pub smtp_host: String,
pub smtp_port: u16,
pub smtp_username: Option<String>,
pub smtp_password: Option<String>,
pub tls_mode: TlsMode,
pub from_address: String,
pub from_name: String,
pub reply_to: Option<String>,
pub connection_timeout: Duration,
pub send_timeout: Duration,
pub pool_size: usize,
}Expand description
Email configuration
Fields§
§smtp_host: StringSMTP server host
smtp_port: u16SMTP server port (typically 587 for STARTTLS, 465 for TLS, 25 for none)
smtp_username: Option<String>SMTP username (often ‘apikey’ for services like SendGrid)
smtp_password: Option<String>SMTP password or API key
tls_mode: TlsModeTLS mode
from_address: StringFrom email address
from_name: StringFrom display name
reply_to: Option<String>Reply-to address (optional)
connection_timeout: DurationConnection timeout
send_timeout: DurationSend timeout per email
pool_size: usizeConnection pool size
Implementations§
Source§impl EmailConfig
impl EmailConfig
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create configuration from environment variables
§Environment Variables
Required:
EMAIL_SMTP_HOST- SMTP server hostnameEMAIL_FROM_ADDRESS- Sender email address
Optional:
EMAIL_SMTP_PORT- SMTP port (default: 587)EMAIL_SMTP_USERNAME- SMTP usernameEMAIL_SMTP_PASSWORD- SMTP password/API keyEMAIL_SMTP_TLS- TLS mode: none, starttls, required (default: starttls)EMAIL_FROM_NAME- Sender display name (default: “Gatekpr”)EMAIL_REPLY_TO- Reply-to addressEMAIL_CONNECTION_TIMEOUT- Connection timeout in seconds (default: 10)EMAIL_SEND_TIMEOUT- Send timeout in seconds (default: 30)EMAIL_POOL_SIZE- Connection pool size (default: 4)
Sourcepub fn builder() -> EmailConfigBuilder
pub fn builder() -> EmailConfigBuilder
Create a builder for custom configuration
Trait Implementations§
Source§impl Clone for EmailConfig
impl Clone for EmailConfig
Source§fn clone(&self) -> EmailConfig
fn clone(&self) -> EmailConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmailConfig
impl Debug for EmailConfig
Source§impl Default for EmailConfig
impl Default for EmailConfig
Source§impl<'de> Deserialize<'de> for EmailConfig
impl<'de> Deserialize<'de> for EmailConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EmailConfig
impl RefUnwindSafe for EmailConfig
impl Send for EmailConfig
impl Sync for EmailConfig
impl Unpin for EmailConfig
impl UnwindSafe for EmailConfig
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