pub struct Email<'a> {Show 16 fields
pub body: Option<Cow<'a, str>>,
pub from: Vec<Mailbox<'a>>,
pub sender: Mailbox<'a>,
pub subject: Option<Cow<'a, str>>,
pub date: DateTime,
pub to: Option<Vec<Address<'a>>>,
pub cc: Option<Vec<Address<'a>>>,
pub bcc: Option<Vec<Address<'a>>>,
pub message_id: Option<(Cow<'a, str>, Cow<'a, str>)>,
pub in_reply_to: Option<Vec<(Cow<'a, str>, Cow<'a, str>)>>,
pub references: Option<Vec<(Cow<'a, str>, Cow<'a, str>)>>,
pub reply_to: Option<Vec<Address<'a>>>,
pub comments: Vec<Cow<'a, str>>,
pub keywords: Vec<Vec<Cow<'a, str>>>,
pub trace: Vec<(Option<Option<EmailAddress<'a>>>, Vec<(Vec<ReceivedToken<'a>>, DateTime)>, Vec<TraceField<'a>>)>,
pub unknown_fields: Vec<(&'a str, Cow<'a, str>)>,
}
Expand description
A struct representing a valid RFC 5322 message.
§Example
let email = Email::parse(
b"\
From: Mubelotix <mubelotix@mubelotix.dev>\r\n\
Subject:Example Email\r\n\
To: Someone <example@example.com>\r\n\
Message-id: <6546518945@mubelotix.dev>\r\n\
Date: 5 May 2003 18:58:34 +0000\r\n\
\r\n\
Hey!\r\n",
)
.unwrap();
assert_eq!(email.subject.unwrap(), "Example Email");
assert_eq!(email.sender.name.unwrap(), vec!["Mubelotix"]);
assert_eq!(email.sender.address.local_part, "mubelotix");
assert_eq!(email.sender.address.domain, "mubelotix.dev");
Fields§
§body: Option<Cow<'a, str>>
The ASCII text of the body.
from: Vec<Mailbox<'a>>
The list of authors of the message.
It’s not the identity of the sender. See the sender field.
sender: Mailbox<'a>
The mailbox of the agent responsible for the actual transmission of the message.
Do not mix up with the from field that contains the list of authors.
When there is only one author, this field can be omitted, and its value is inferred. Otherwise, an explicit value is required.
subject: Option<Cow<'a, str>>
A short optional string identifying the topic of the message.
date: DateTime
The date and time at which the sender of the message indicated that the message was complete and ready to enter the mail delivery system. For instance, this might be the time that a user pushes the “send” or “submit” button in an application program.
to: Option<Vec<Address<'a>>>
§cc: Option<Vec<Address<'a>>>
§bcc: Option<Vec<Address<'a>>>
§message_id: Option<(Cow<'a, str>, Cow<'a, str>)>
§in_reply_to: Option<Vec<(Cow<'a, str>, Cow<'a, str>)>>
§references: Option<Vec<(Cow<'a, str>, Cow<'a, str>)>>
§reply_to: Option<Vec<Address<'a>>>
§comments: Vec<Cow<'a, str>>
§keywords: Vec<Vec<Cow<'a, str>>>
§trace: Vec<(Option<Option<EmailAddress<'a>>>, Vec<(Vec<ReceivedToken<'a>>, DateTime)>, Vec<TraceField<'a>>)>
§unknown_fields: Vec<(&'a str, Cow<'a, str>)>
The list of unrecognized fields.
Each field is stored as a (name, value)
tuple.