Provider-agnostic newsletter subscriptions with Mailchimp driver.
Author: Javid Fazaeli
ExpressionEngine newsletter subscription add-on
JSubscriberX is a lightweight ExpressionEngine add-on for handling newsletter subscriptions.
Itβs built for flexibility, security, and easy integration with mailing services.
- Secure form handling using ExpressionEngine Actions
- Encrypt/Decrypt functions to store API Keys
- Honeypot, CSRF
- Double opt-in support β normalized
pendingstatus and βcheck your inboxβ messaging - Test connection β quick provider health check from the CP or via an Action
- Clean, semantic form markup
- Works with AJAX/fetch() and classic POST forms
- β Mailchimp β built-in and fully supported
- π§ Extensible architecture β developers can register custom providers (e.g., SendGrid, SES, Listmonk) by implementing the same interface used by
subx->subscribe()
Example
// Default provider (Mailchimp) is bundled:
$svc = ee('jsubscriberx:subx');
$res = $svc->subscribe( 'user@example.com', [ 'tags' => ['newsletter'] ] ); You can submit to the add-onβs Action either via action_url (form action attribute) or a hidden action_id input.
Option A β Hidden action_id input
Recommended, since you have more control over the response
<form class="footer-newsletter" method="post">
<input type="hidden" name="csrf_token" value="{csrf_token}">
<input type="hidden" name="action_id" value="{exp:jsubscriberx:action_id method='SubscribeX'}">
<input type="text" name="hp" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px;">
<input type="email" name="email" placeholder="youremail@example.com" required autocomplete="email">
<button class="submit-btn" name="submit" value="1" type="submit">Subscribe</button>
</form><form class="footer-newsletter" method="post" action="{exp:jsubscriberx:action_url method='SubscribeX'}">
<!-- CSRF protection -->
<input type="hidden" name="csrf_token" value="{csrf_token}">
<!-- Honeypot -->
<input type="text" name="hp" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px;">
<!-- Email input -->
<input type="email" name="email" placeholder="youremail@example.com" required autocomplete="email">
<!-- Optional redirect after success -->
<!-- <input type="hidden" name="return" value="{path='newsletter/thanks'}"> -->
<button class="submit-btn" name="submit" value="1" type="submit">Subscribe</button>
</form>- Copy the add-on into your ExpressionEngine add-ons directory:
/system/user/addons/jsubscriberx
- In the Control Panel: Add-ons β Install JSubscriberX
- Insert one of the example forms into your template(s)
If your provider/account enforces double opt-in, JSubscriberX normalizes the response to:
status: "pending"with a message like βCheck your inbox to confirm.β
No template changes are requiredβmessaging is handled for you.
Ensure provider credentials are configured (via env/config and/or add-on settings). Then:
- Control Panel: Add-ons β JSubscriberX β Test Connection (shows provider status/HTTP code)
Redirect users after a successful subscription:
<input type="hidden" name="return" value="{path='newsletter/thanks'}">On immediate subscribe:
{ "success": true, "status": "subscribed", "message": "You are subscribed.", "http": 200 }On double opt-in:
{ "success": true, "status": "pending", "message": "Check your inbox to confirm.", "http": 202 }On Honeypot:
{ "success": true, "status": "ignored", "message": "", "http": 200 }On provider error:
{ "success": false, "status": "error", "message": "Invalid email", "http": 422 }On MX Record check:
{ "success": false, "status": "error", "message": "Email domain does not accept mail", "http": 422 }$honeypot = ee()->input->post('hp');
if (! empty($honeypot)) {
return $this->respond(['success' => true, 'status' => 'ignored', 'message' => ''], 200, $isAjax);
}- PHP / ExpressionEngine 7+ compatible
- Uses EE Action flow
- Namespaced:
JavidFazaeli\JSubscriberX - Normalized response shape:
success(true|false)status(subscribed|pending|ignored|error)message(human-readable)http(HTTP status code)
PRs welcome:
- Fork the repo
- Create a branch:
feature/my-improvement - Open a PR with a clear description
This project is open-sourced software licensed under the MIT license.
See CHANGELOG.md for release history.
Javid Fazaeli
- π https://fazaeli.dev
- π§ javid@fazaeli.dev
- π https://github.com/jfaza



