16 Mail
(require koyo/mail) | package: koyo-lib |
This module provides functionality for sending e-mail.
16.1 Mailer
The mailer is a component that wraps a mail-adapter? along with a default value for the sender and common variables for some of the template model properties.
procedure
(make-mailer-factory #:adapter adapter #:sender sender #:common-variables common-variables) → (-> mailer?) adapter : mail-adapter? sender : non-empty-string? common-variables : (hash/c symbol? string?)
procedure
(mailer-sender mailer) → non-empty-string?
mailer : mailer?
procedure
(mailer-send-email-with-template mailer #:to to [ #:from from #:template-id template-id #:template-alias template-alias #:template-model template-model]) → void? mailer : mailer? to : non-empty-string? from : non-empty-string? = (mailer-sender mailer) template-id : (or/c false/c exact-positive-integer?) = #f template-alias : (or/c false/c symbol?) = #f template-model : (hash/c symbol? string?) = (hasheq)
The #:template-model hash is merged with the #:common-variables the mailer was created with prior to being passed to mail-adapter-send-email-with-template.
16.2 Adapters
Mail adapters expose a consistent interface for values that can send e-mail.
interface
procedure
(mail-adapter? v) → boolean?
v : any/c
procedure
(mail-adapter-send-email-with-template adapter #:to to #:form from [ #:template-id template-id #:template-alias template-alias] #:template-model template-model) → void? adapter : mail-adapter? to : non-empty-string? from : non-empty-string? template-id : (or/c exact-positive-integer?) = #f template-alias : (or/c symbol?) = #f template-model : (hash/c symbol? string?)
The #:template-id and #:template-alias arguments to mail-adapter-send-email-with-template are mutually exclusive.
procedure
procedure
(stub-mail-adapter? v) → boolean?
v : any/c
procedure
(stub-mail-adapter-outbox adapter) → (listof hash?)
adapter : stub-mail-adapter?
16.2.1 Other Adapters
koyo-postmark provides a mail adapter for interfacing with the Postmark API.