← all modules
Std.Email
Std.Email
Std.Email — provider-abstract email send (Layer 3 Sky source).
Types
type alias EmailMessage
type alias Attachment
type alias SesConfig
type alias SmtpConfig
type EmailProvider = Resend String | Ses SesConfig | SendGrid String | Smtp SmtpConfig
Values
defaultAttachment : String -> Attachment
`defaultAttachment "report.pdf"` — Attachment named with empty
defaultMessage : { from : String , to : List String , subject : String } -> EmailMessage
Construct a baseline message with the three required fields
defaultSesConfig : String -> SesConfig
`defaultSesConfig "us-east-1"` — SesConfig with the region set;
defaultSmtpConfig : String -> SmtpConfig
`defaultSmtpConfig "smtp.example.com"` — SmtpConfig with host
send : EmailProvider -> EmailMessage -> Task Error String
`send provider message` — submit the message to the chosen
withAttachment : Attachment -> EmailMessage -> EmailMessage
Append one attachment. Call repeatedly for multiple files.
withBcc : List String -> EmailMessage -> EmailMessage
Override BCC.
withCc : List String -> EmailMessage -> EmailMessage
Override CC.
withContent : String -> Attachment -> Attachment
`withContent bytes att` — replace the attachment body bytes.
withHtmlBody : String -> EmailMessage -> EmailMessage
Override the HTML body. Most providers fall back to textBody
withMimeType : String -> Attachment -> Attachment
`withMimeType "application/pdf" att` — replace the MIME type.
withReplyTo : String -> EmailMessage -> EmailMessage
Override Reply-To.
withSesKey : String -> SesConfig -> SesConfig
`withSesKey "AKIA..." cfg` — replace the SES access key.
withSesSecret : String -> SesConfig -> SesConfig
`withSesSecret "..." cfg` — replace the SES secret key. Never
withSmtpPass : String -> SmtpConfig -> SmtpConfig
`withSmtpPass "..." cfg` — replace the SMTP password. Never
withSmtpPort : Int -> SmtpConfig -> SmtpConfig
`withSmtpPort 465 cfg` — replace the SMTP port.
withSmtpUser : String -> SmtpConfig -> SmtpConfig
`withSmtpUser "user" cfg` — replace the SMTP username.
withTextBody : String -> EmailMessage -> EmailMessage
Override the plain-text body.