pub struct Email {
pub id: Uuid,
pub from: String,
pub to: Vec<String>,
pub cc: Option<Vec<String>>,
pub bcc: Option<Vec<String>>,
pub reply_to: Option<String>,
pub subject: String,
pub html_body: Option<String>,
pub text_body: Option<String>,
pub attachments: Vec<Attachment>,
pub headers: HashMap<String, String>,
pub tracking: TrackingOptions,
}Expand description
Core email message structure
Fields§
§id: UuidUnique identifier for tracking
from: StringSender email address
to: Vec<String>Recipient email addresses
cc: Option<Vec<String>>CC recipients
bcc: Option<Vec<String>>BCC recipients
reply_to: Option<String>Reply-to address
subject: StringEmail subject
html_body: Option<String>HTML body content
text_body: Option<String>Plain text body content
attachments: Vec<Attachment>Email attachments
headers: HashMap<String, String>Email headers
tracking: TrackingOptionsTracking metadata
Implementations§
Source§impl Email
Extension methods for Email to work with templates
impl Email
Extension methods for Email to work with templates
Sourcepub fn from_template(
engine: &TemplateEngine,
template: &EmailTemplate,
context: impl IntoTemplateContext,
) -> Result<Self, EmailError>
pub fn from_template( engine: &TemplateEngine, template: &EmailTemplate, context: impl IntoTemplateContext, ) -> Result<Self, EmailError>
Create email from template
Sourcepub fn with_template(
self,
engine: &TemplateEngine,
template_name: &str,
context: impl IntoTemplateContext,
) -> Result<Self, EmailError>
pub fn with_template( self, engine: &TemplateEngine, template_name: &str, context: impl IntoTemplateContext, ) -> Result<Self, EmailError>
Update email with rendered template content by name
Sourcepub fn with_template_struct(
self,
engine: &TemplateEngine,
template: &EmailTemplate,
context: impl IntoTemplateContext,
) -> Result<Self, EmailError>
pub fn with_template_struct( self, engine: &TemplateEngine, template: &EmailTemplate, context: impl IntoTemplateContext, ) -> Result<Self, EmailError>
Update email with rendered template content using EmailTemplate struct
Source§impl Email
Extension methods for Email validation
impl Email
Extension methods for Email validation
Sourcepub fn validate(&self) -> Result<(), EmailError>
pub fn validate(&self) -> Result<(), EmailError>
Validate this email
Source§impl Email
impl Email
Sourcepub fn attach(self, attachment: Attachment) -> Self
pub fn attach(self, attachment: Attachment) -> Self
Add attachment
Sourcepub fn with_tracking(self, track_opens: bool, track_clicks: bool) -> Self
pub fn with_tracking(self, track_opens: bool, track_clicks: bool) -> Self
Enable tracking
Sourcepub fn attach_inline(self, attachment: Attachment) -> Self
pub fn attach_inline(self, attachment: Attachment) -> Self
Add an inline attachment (for embedding in HTML emails)
Sourcepub fn validate_attachments(
&self,
config: &AttachmentConfig,
) -> Result<(), EmailError>
pub fn validate_attachments( &self, config: &AttachmentConfig, ) -> Result<(), EmailError>
Validate all attachments against configuration
Sourcepub fn inline_attachments(&self) -> Vec<&Attachment>
pub fn inline_attachments(&self) -> Vec<&Attachment>
Get all inline attachments (for HTML embedding)
Sourcepub fn regular_attachments(&self) -> Vec<&Attachment>
pub fn regular_attachments(&self) -> Vec<&Attachment>
Get all regular attachments
Sourcepub fn compress_attachments(
&mut self,
config: &AttachmentConfig,
) -> Result<(), EmailError>
pub fn compress_attachments( &mut self, config: &AttachmentConfig, ) -> Result<(), EmailError>
Apply compression to all attachments if configured
Sourcepub fn estimated_compressed_size(&self) -> usize
pub fn estimated_compressed_size(&self) -> usize
Get estimated size after compression