pub struct Composition {
pub from: Option<Mailbox>,
pub to: Vec<Mailbox>,
pub cc: Vec<Mailbox>,
pub bcc: Vec<Mailbox>,
pub subject: String,
pub body: String,
pub html_body: Option<String>,
pub attachments: Vec<Attachment>,
pub reply: Option<ReplyContext>,
pub message_id_domain: Option<String>,
}Expand description
A message to build: text/plain, or multipart/alternative when it has
an HTML body.
Fields§
§from: Option<Mailbox>The From mailbox. None leaves the header out, and Gmail fills in
the account’s primary address. Gmail only sends as a verified
send-as alias, so the caller checks it first (see
crate::gmail::send_as_api::resolve_from).
to: Vec<Mailbox>To recipients.
cc: Vec<Mailbox>Cc recipients.
bcc: Vec<Mailbox>Bcc recipients. Kept as a header: Gmail reads it from the draft
when the draft is sent, and strips it from what recipients receive.
subject: StringThe Subject. May be empty.
body: StringThe plain-text body, or with html_body its plain-text alternative.
html_body: Option<String>The HTML body. Sent as multipart/alternative after body, so
clients that can render HTML show this one.
attachments: Vec<Attachment>Files attached after the body. Any attachment makes the message
multipart/mixed.
reply: Option<ReplyContext>When replying: the source of In-Reply-To and References.
message_id_domain: Option<String>The domain for the generated Message-ID, normally the account
address’s (see message_id_domain). None leaves the id to
mail-builder, which ends it in @localhost.
Implementations§
Source§impl Composition
impl Composition
Sourcepub fn build(&self) -> Result<Vec<u8>>
pub fn build(&self) -> Result<Vec<u8>>
Serialises the message to RFC 5322 bytes with CRLF line endings.
The Message-ID is <{random}@{message_id_domain}>. Gmail replaces
it on the stored draft (#1966), but whether the id is also replaced
when the draft is sent is unverified (#1953), so it is made valid
either way rather than left as @localhost.
Trait Implementations§
Source§impl Clone for Composition
impl Clone for Composition
Source§impl Debug for Composition
impl Debug for Composition
Auto Trait Implementations§
impl Freeze for Composition
impl RefUnwindSafe for Composition
impl Send for Composition
impl Sync for Composition
impl Unpin for Composition
impl UnsafeUnpin for Composition
impl UnwindSafe for Composition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more