z_email (zotonic_core v1.0.0-rc.14)

Send e-mail to a recipient. Optionally queue low priority messages.

Link to this section Summary

Functions

Combine a name and an email address to the format jan janssen <jan@example.com>
If the recipient is an resource id, ensure that it is formatted as an email address.
Return the email address to be used in emails for the given id. The address will be formatted using the recipient's name.
Fetch the e-mail address of the site administrator
Fetch the default From e-mail address. Defaults to noreply@hostname
Send an email message defined by the email record.
Send a simple text message to an email address
Send a simple text message to the administrator
Send a page to an e-mail address, assumes the correct template "mailing_page.tpl" is available. Defaults for these pages are supplied by mod_mailinglist.
Send a html message to an email address, render the message using a template.
Send a html and text message to an email address, render the message using two templates.
Queue a simple text message to an email address
Queue a html message to an email address, render the message using a template.
Queue a html and text message to an email address, render the message using two templates.
Split the name and email from the format jan janssen <jan@example.com>

Link to this section Functions

Link to this function

bounce_domain(Context)

-spec bounce_domain(z:context()) -> binary().
Link to this function

combine_name_email(Name, Email)

-spec combine_name_email(Name, Email) -> NameEmail
                      when
                          Name :: binary() | string() | undefined,
                          Email :: binary() | string(),
                          NameEmail :: binary().
Combine a name and an email address to the format jan janssen <jan@example.com>
Link to this function

email_domain(Context)

-spec email_domain(z:context()) -> binary().
Link to this function

ensure_domain(Email, Context)

-spec ensure_domain(binary() | string(), z:context()) -> binary().
Link to this function

ensure_to_email(Email, Context)

-spec ensure_to_email(#email{}, z:context()) -> {ok, #email{}} | {error, term()}.
If the recipient is an resource id, ensure that it is formatted as an email address.
Link to this function

format_recipient(RecipientId, Context)

-spec format_recipient(RecipientId, Context) -> {ok, EmailAddress} | {error, Reason}
                    when
                        RecipientId :: m_rsc:resource(),
                        Context :: z:context(),
                        EmailAddress :: binary(),
                        Reason :: enoent | no_email | eacces.
Return the email address to be used in emails for the given id. The address will be formatted using the recipient's name.
Link to this function

get_admin_email(Context)

-spec get_admin_email(z:context()) -> binary().
Fetch the e-mail address of the site administrator
Link to this function

get_email_from(Context)

-spec get_email_from(z:context()) -> binary().
Fetch the default From e-mail address. Defaults to noreply@hostname
Link to this function

send(Email, Context)

Send an email message defined by the email record.
Link to this function

send(MsgId, Email, Context)

Link to this function

send(To, Subject, Message, Context)

Send a simple text message to an email address
Link to this function

send_admin(Subject, Message, Context)

-spec send_admin(iodata(), iodata(), z:context()) ->
              {ok, MsgId :: binary()} | {error, sender_disabled | term()}.
Send a simple text message to the administrator
Link to this function

send_page(Email, Id, Context)

Send a page to an e-mail address, assumes the correct template "mailing_page.tpl" is available. Defaults for these pages are supplied by mod_mailinglist.
Link to this function

send_render(To, HtmlTemplate, Vars, Context)

Send a html message to an email address, render the message using a template.
Link to this function

send_render(To, HtmlTemplate, TextTemplate, Vars, Context)

Send a html and text message to an email address, render the message using two templates.
Link to this function

sendq(To, Subject, Message, Context)

Queue a simple text message to an email address
Link to this function

sendq_render(To, HtmlTemplate, Vars, Context)

Queue a html message to an email address, render the message using a template.
Link to this function

sendq_render(To, HtmlTemplate, TextTemplate, Vars, Context)

Queue a html and text message to an email address, render the message using two templates.
Link to this function

split_name_email(String)

-spec split_name_email(String) -> {Name, Email}
                    when String :: string() | binary(), Name :: binary(), Email :: binary().
Split the name and email from the format jan janssen <jan@example.com>