pub struct Message { /* private fields */ }Expand description
One email, before it becomes bytes.
Implementations§
Source§impl Message
impl Message
pub fn new() -> Message
pub fn from(self, address: impl IntoAddress) -> Message
pub fn to(self, address: impl IntoAddress) -> Message
pub fn cc(self, address: impl IntoAddress) -> Message
Sourcepub fn bcc(self, address: impl IntoAddress) -> Message
pub fn bcc(self, address: impl IntoAddress) -> Message
A blind copy. The address reaches the server in RCPT TO and appears in
no header — that is the whole point, and getting it wrong discloses
every recipient to every other one.
pub fn reply_to(self, address: impl IntoAddress) -> Message
pub fn subject(self, subject: impl Into<String>) -> Message
pub fn text(self, body: impl Into<String>) -> Message
pub fn html(self, body: impl Into<String>) -> Message
pub fn attach(self, attachment: Attachment) -> Message
Sourcepub fn header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Message
pub fn header( self, name: impl Into<String>, value: impl Into<String>, ) -> Message
Add a header of your own. X- headers, mostly.
Sourcepub fn with_date(self, date: impl Into<String>) -> Message
pub fn with_date(self, date: impl Into<String>) -> Message
Pin the Date header. Tests want a message that does not change between
runs; nothing else should call this.
Sourcepub fn with_message_id(self, id: impl Into<String>) -> Message
pub fn with_message_id(self, id: impl Into<String>) -> Message
Pin the Message-ID, for the same reason as Message::with_date.
Sourcepub fn with_boundary(self, boundary: impl Into<String>) -> Message
pub fn with_boundary(self, boundary: impl Into<String>) -> Message
Pin the MIME boundary, for the same reason again.
pub fn sender(&self) -> Option<&Address>
pub fn subject_text(&self) -> &str
pub fn text_body(&self) -> Option<&str>
pub fn html_body(&self) -> Option<&str>
pub fn attachments(&self) -> &[Attachment]
pub fn to_addresses(&self) -> &[Address]
Sourcepub fn recipients(&self) -> Vec<&Address>
pub fn recipients(&self) -> Vec<&Address>
Everyone the message is addressed to, headers included.
Sourcepub fn envelope_recipients(&self) -> Vec<String>
pub fn envelope_recipients(&self) -> Vec<String>
The envelope: who the server is asked to deliver to, Bcc included.
Sourcepub fn to_smtp_data(&self) -> Result<String>
pub fn to_smtp_data(&self) -> Result<String>
The message as the DATA phase wants it: dot-stuffed, CRLF throughout.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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