Skip to main content

Crate apiplant_email

Crate apiplant_email 

Source
Expand description

§apiplant-email

One way to send a message, whichever service actually sends it.

An app names a provider in main.toml:

[email]
provider = "sendgrid"
from     = "no-reply@example.com"
api_key  = "${SENDGRID_API_KEY}"

…and a function calls ctx.send_email(...). Everything between those two points is this crate: it builds the provider’s own request shape, signs or authenticates it, and normalises the reply to a Sent receipt. Changing provider to ses changes the wire format, the authentication scheme and the endpoint — and changes nothing a function can see.

§Supported providers

providerTransportCredentials
smtpSMTP (STARTTLS/implicit TLS)[email.smtp] host/username/password
sesAmazon SES v2 HTTPS API, SigV4api_key = access key id, api_secret = secret, region
sendgridapi.sendgrid.com/v3/mail/sendapi_key
brevo (sendinblue)api.brevo.com/v3/smtp/emailapi_key
mailjetapi.mailjet.com/v3.1/sendapi_key + api_secret
mailgunapi.mailgun.net/v3/<domain>/messagesapi_key + domain
postmarkapi.postmarkapp.com/emailapi_key (server token)
resendapi.resend.com/emailsapi_key

Anything not on that list still works over smtp, which every one of them also speaks.

Structs§

Address
One mailbox: an address, optionally with a display name.
Mailer
A configured, ready-to-use sender.
Message
A message to send.
Sent
Proof that a provider accepted a message.

Enums§

EmailError
What went wrong while sending.
Provider
Which service sends the mail.