z_email_server (zotonic_core v1.0.0-rc.11)

Email server. Queues, renders and sends e-mails.

Link to this section Summary

Functions

Handle a bounce
Convert process state when code is changed
Handle a delivery report from an outside service like mailgun
Generate a new message id
Send an e-mail.
Poll the database queue for any retrys.
Initiates the server.
Check if the received e-mail address is a bounce address
Check if the sender is allowed to send email. If an user is disabled they are only allowed to send mail to themselves or to the admin.
Check if a file is a tempfile of the emailer
Return the max age of a tempfile
Force a poll to send new email
Send an email
Send an email using a predefined unique id.
Starts the server
Return the filename for a tempfile that can be used for the emailer
This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

Link to this section Types

Link to this type

delivery_type/0

-type delivery_type() :: permanent_failure | temporary_failure | sent | received | relayed.

Link to this section Functions

Link to this function

bounced(Peer, NoReplyEmail)

Handle a bounce
Link to this function

code_change(OldVsn, State, Extra)

Convert process state when code is changed
Link to this function

delivery_report(What, OptRecipient, MsgIdHeader, OptStatusMessage)

-spec delivery_report(delivery_type(), binary() | undefined, binary(), binary() | undefined) -> ok.
Handle a delivery report from an outside service like mailgun
Link to this function

generate_message_id()

-spec generate_message_id() -> binary().
Generate a new message id
Link to this function

get_email_from(Context)

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

handle_call(Message, From, State)

Link to this function

handle_cast(Message, State)

Send an e-mail.
Link to this function

handle_info(Info, State)

Poll the database queue for any retrys.
Initiates the server.
Link to this function

is_bounce_email_address(_)

Check if the received e-mail address is a bounce address
Link to this function

is_recipient_blocked(Recipient, Context)

Link to this function

is_sender_enabled(Email, Context)

Check if the sender is allowed to send email. If an user is disabled they are only allowed to send mail to themselves or to the admin.
Link to this function

is_sender_enabled(Id, RecipientEmail, Context)

Link to this function

is_tempfile(File)

Check if a file is a tempfile of the emailer
Link to this function

is_tempfile_deletable(File)

Return the max age of a tempfile
-spec poll() -> ok.
Force a poll to send new email
Link to this function

send(Email, Context)

Send an email
Link to this function

send(EmailId, Email, Context)

Send an email using a predefined unique id.
-spec start_link() -> {ok, pid()} | ignore | {error, term()}.
Starts the server
Return the filename for a tempfile that can be used for the emailer
Link to this function

terminate(Reason, State)

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.