Contents
6 submodules, and what the module defines itself.
use utopia_messaging::email::format_address;pub fn format_address(email: &str, name: Option<&str>) -> StringAn address with an optional display name, the name quoted when it
carries RFC 5322 specials ("Acme, Inc." <a@example.com>).
pub const MAX_ATTACHMENT_BYTES: u64 = 25 * 1024 * 1024The attachment limit of an email adapter, unless it says otherwise.
pub const TYPE: &str = "email"The kind of every email adapter.
email::mailgun
Own pageuse utopia_messaging::email::mailgun::Mailgun;pub struct MailgunMailgun's messages API, one batch request for every recipient (recipient variables keep them from seeing each other).
email::mime
Own pageAn email as a MIME message on the wire, which the SMTP adapter hands over whole and SES sends as a raw message per recipient.
use utopia_messaging::email::mime::addresses;pub fn addresses(recipients: &[Mailbox]) -> Result<Vec<Address>, Error>The recipients as addresses (a missing name is empty).
use utopia_messaging::email::mime::attachments;pub fn attachments(email: &Email) -> Result<Vec<Attachment>, Error>The email's attachments: read from their path when written, or from the content given.
use utopia_messaging::email::mime::message;pub fn message(email: &Email, to: &[Mailbox], cc: &[Mailbox], bcc: &[Mailbox], headers: &[(String, String)]) -> Result<Message, Error>The message for email, addressed to to and cc, with bcc in the
envelope only, and headers of the adapter's own (X-Mailer), which
win over the email's headers of the same name in any case.
The text part is the content, or for HTML the content without style blocks and tags.
use utopia_messaging::email::mime::size;pub fn size(email: &Email) -> Result<u64, Error>What the attachments weigh before they are encoded.
Fails with Error::Exception for a file that cannot be read.
email::resend
Own pageuse utopia_messaging::email::resend::Resend;pub struct ResendResend's email API: one batch request, or one request per recipient when there are attachments (batches cannot carry them).
pub const MAX_ATTACHMENT_BYTES: u64 = 40 * 1024 * 1024Resend's attachment limit.
email::sendgrid
Own pageuse utopia_messaging::email::sendgrid::Sendgrid;pub struct SendgridSendGrid's mail send API: one request, a personalization per recipient.
email::ses
Own pageuse utopia_messaging::email::ses::Ses;pub struct SesAmazon SES over the v2 API, signed with AWS Signature Version 4.
Without attachments, one SendBulkEmail request carries every
recipient, with the content registered once as a template named after
its hash (created on first use, never deleted). With attachments, one
SendEmail request per recipient carries a raw MIME message.
pub const MAX_ATTACHMENT_BYTES: u64 = 10 * 1024 * 1024SES's limit on a whole MIME message.
pub const MAX_DESTINATIONS: i64 = 50SES's cap on destinations per bulk request.
email::smtp
Own pageuse utopia_messaging::email::smtp::Host;pub struct HostA server to try: host (an address literal stays bracketed), port and encryption.
use utopia_messaging::email::smtp::Mock;pub struct MockThe SMTP adapter pointed at a mail catcher: no credentials, no
encryption, X-Mailer: Utopia Mailer, and named Mock.
use utopia_messaging::email::smtp::NoHostAnswered;pub struct NoHostAnsweredEvery host in the list failed before a session was open: the message
names each host's failure, and permanent says whether trying the list
again can go differently (only when every host refused for good).
use utopia_messaging::email::smtp::Smtp;pub struct SmtpAn SMTP relay: one or several hosts tried in order, with STARTTLS or implicit TLS, PLAIN or LOGIN authentication, and optionally a session kept open across sends. Every recipient gets the server's own answer.
Debug.