{"result":{"depiction_url":null,"edges":{"observes":{"objects":[{"created":"2026-10-22T10:04:00Z","object_id":{"id":1520,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_email_status","title":"observe_email_status\/2","uri":"https:\/\/zotonic.com\/id\/1520"},"seq":1},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2292,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_email_send_encoded","title":"observe_email_send_encoded\/2","uri":"https:\/\/zotonic.com\/id\/2292"},"seq":2}],"predicate":{"id":2550,"is_a":["meta","predicate"],"name":"observes","title":{"_type":"trans","tr":{"en":"Observes"}},"uri":"https:\/\/zotonic.com\/id\/observes"}},"subject":{"objects":[{"created":"2026-10-22T10:04:00Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2562,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_site_administrator","title":"Site administrator","uri":"https:\/\/zotonic.com\/id\/2562"},"seq":2},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":3},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2595,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_email_delivery","title":"Email delivery","uri":"https:\/\/zotonic.com\/id\/2595"},"seq":4},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2599,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_api_and_integration","title":"API and integration","uri":"https:\/\/zotonic.com\/id\/2599"},"seq":5},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2603,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_configuration","title":"Configuration","uri":"https:\/\/zotonic.com\/id\/2603"},"seq":6},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2635,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_module","title":"Module","uri":"https:\/\/zotonic.com\/id\/2635"},"seq":7},{"created":"2026-10-22T10:04:00Z","object_id":{"id":2654,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_send_and_receive","title":"Send and receive","uri":"https:\/\/zotonic.com\/id\/2654"},"seq":8}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":3098,"is_a":["text","documentation","reference","module"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3098"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_external_6_mod_mailgun","page_url":{"en":"https:\/\/zotonic.com\/docs\/3098\/mod_mailgun","x-default":"https:\/\/zotonic.com\/docs\/3098\/mod_mailgun"},"preview_url":null,"resource":{"version":21,"pivot_location_lat":null,"title":"mod_mailgun","is_authoritative":true,"body":"<p>Relay outgoing email through the Mailgun HTTP API and receive delivery and\nengagement events through a signed webhook. Requires <code>mod_email_status<\/code>.<\/p>\n<h2>Setup and configuration<\/h2>\n<p>Enable <code>mod_mailgun<\/code> on the site. Configure its per-site <code>m_config<\/code> values in\nthe Mailgun panel under <strong>System &gt; Mail settings<\/strong>. Saving these settings\nrequires an administrator with configuration-edit permission:<\/p>\n<table class=\"table\"><thead><tr><th>Key<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td><code>mod_mailgun.domain<\/code><\/td><td>Sending domain configured in Mailgun.<\/td><\/tr><tr><td><code>mod_mailgun.api_url<\/code><\/td><td>Full API base URL including the domain, without a trailing slash. Defaults to <code>https:\/\/api.mailgun.net\/v3\/<\/code> followed by <code>domain<\/code>.<\/td><\/tr><tr><td><code>mod_mailgun.api_key<\/code><\/td><td>API key used for HTTP Basic authentication with username <code>api<\/code>.<\/td><\/tr><tr><td><code>mod_mailgun.webhook_secret<\/code><\/td><td>Signing key used to verify incoming webhook requests.<\/td><\/tr><\/tbody><\/table>\n<p>For example, a domain of <code>mg.example.com<\/code> uses the default API base URL\n<code>https:\/\/api.mailgun.net\/v3\/mg.example.com<\/code>. The administration panel also\nprovides a regional endpoint example. Configure both the sending domain (or a\ncomplete API URL) and the API key before sending mail.<\/p>\n<h2>Outgoing mail and address status<\/h2>\n<p>The <code>email_send_encoded<\/code> observer posts the encoded MIME message to\n<code>&lt;api_url&gt;\/messages.mime<\/code>. This path uses the HTTP API and does not require\nSMTP relay settings. If both <code>api_url<\/code> and <code>api_key<\/code> are empty, the observer\nreturns <code>undefined<\/code>, leaving delivery to other handlers. Setting either value\nactivates the API path; this presence check does not verify the credentials or\nservice availability. A domain alone does not activate it.<\/p>\n<p>An HTTP 200 response means Mailgun accepted the message. Other HTTP responses\nare returned as temporary failures; delivery to the recipient is reported\nseparately by the webhook.<\/p>\n<p>Manual <code>email_status<\/code> changes synchronize the address with Mailgun&#39;s bounce\nlist: blocking adds it and clearing removes it. Non-manual status changes are\nignored. The exported <code>mailgun_block\/2<\/code> and <code>mailgun_clear\/2<\/code> helpers return the\nHTTP client result, or <code>ok<\/code> when the API is unconfigured. These Erlang helpers\ndo not perform an ACL check; callers must authorize manual changes.<\/p>\n<h2>Webhook<\/h2>\n<p>Configure Mailgun to post events to the site&#39;s absolute <code>\/mailgun-webhook<\/code>\nURL and set <code>webhook_secret<\/code> to the matching signing key. The dispatch name\nis <code>mailgun_webhook<\/code>; in templates use <code>{% url mailgun_webhook absolute_url %}<\/code>.\nThe endpoint accepts JSON POST requests authenticated by an HMAC signature,\nwithout requiring a Zotonic user session.<\/p>\n<p>Delivered messages are reported as <code>relayed<\/code>, opened and clicked events mark\nthe address as read, and failed events update delivery status. Spam complaints\nemit a final <code>email_failed<\/code> notification. Unsubscribe events are logged and\nignored. See <code>controller_mailgun_webhook<\/code> for the event mapping.<\/p>","slug":"mod_mailgun","doc_module_config":[],"is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"ab307130a06dc0c2ac1901a40ffca1115be1db1fd3dcab2b8850d7a98f868b69","doc_module_observers":[{"name":"email_send_encoded","page_name":"doc_notification_email_send_encoded"},{"name":"email_status","page_name":"doc_notification_email_status"}],"is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"external_module_id":{"id":6,"is_a":[],"name":null,"title":null,"uri":"https:\/\/zotonic.com\/id\/6"},"git_url":"https:\/\/github.com\/zotonic\/zotonic_mod_mailgun.git","category_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"doc_source_path":".\/src\/mod_mailgun.erl","publication_start":"2026-10-22T10:04:00Z","github_url":"https:\/\/github.com\/zotonic\/zotonic_mod_mailgun.git","pivot_location_lng":null,"doc_source_kind":"external","name":"doc_external_6_mod_mailgun","is_unfindable":false,"is_published":true,"pivot_geocode":null,"external_module_title":"Mailgun","created":"2026-10-22T10:04:00Z","uri":null,"doc_status":"current","is_dependent":false,"is_external_module":true,"publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"ead6c050a61d47e498f9e46208027fe28bdc4d5e","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-10-22T10:04:00Z","title_slug":"mod_mailgun"},"uri":"https:\/\/zotonic.com\/id\/3098","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3098"}},"status":"ok"}