mod_email_relay

This module supports relaying email between Zotonic servers.

With is_email_relay enabled, this server forwards outbound email payloads to another Zotonic relay server at email_relay_url. The two servers authenticate requests using shared secrets: email_relay_send_secret for sending relay requests and email_relay_receive_secret for receiving relay requests. The relay server sends delivery status updates back through webhook reports.

The optional is_user_relay mode relays inbound messages for local username@hostname addresses directly to user mailbox addresses from identity/resource data. This user-relay mode is experimental and should not be relied on for production mail flow.

Accepted Events

This module handles the following notifier callbacks:

  • observe_email_bounced: If the bounced email is a relayed email, then forward a delivery report using z_db:q.

  • observe_email_failed: If the failed email is a relayed email, then forward a delivery report using z_string:sanitize_utf8.

  • observe_email_received: Check if the recipient is a known user, if so redirect the received e-mail as-is to that user using m_config:get_boolean.

  • observe_email_send_encoded: Relay an email via another Zotonic server using m_config:get_boolean.

  • observe_email_sent: If the sent email is a relayed email, then forward a delivery report using z_db:q.

  • observe_email_status: Forward blocking/unblocking of email addresses to the relaying Zotonic server using m_config:get_boolean.

  • observe_tick_24h: Run daily cleanup of relay queues and stale relay status records.

See also

mod_email_receive, E-mail handling.

Edit on GitHub

Models

email_relay

Model for email relay API endpoints, handling relay delivery requests and relay status updates.

See also

mod_email_receive

Enables the Zotonic site to receive emails for the site’s users. The user’s email address is username@hostname, where…

E-mail handling

Any Zotonic system is capable of sending and receiving e-mail messages over SMTP.