WHMCS Integration
Overview
If you use WHMCS to manage your hosting and services business, the Easy Mail Archive WHMCS module lets you automate tenant provisioning directly from your billing system. When a customer purchases your email archiving service, WHMCS automatically creates a tenant. When a customer cancels or fails to pay, WHMCS suspends the tenant.
Module Installation
To install the WHMCS provisioning module:
- Download the module package from your reseller dashboard
- Extract the archive and upload the
easymailarchivefolder to your WHMCS installation undermodules/servers/ - The final path should be
modules/servers/easymailarchive/easymailarchive.php - Log in to your WHMCS admin panel and navigate to Setup > Products/Services > Servers
Server Configuration
In the WHMCS admin panel, add a new server for Easy Mail Archive:
- Go to Setup > Products/Services > Servers
- Click Add New Server
- Enter a name (e.g., "Easy Mail Archive")
- Set the hostname to
api.easymailarchive.com - Enter your reseller API key in the Password field
- Select easymailarchive as the server type
- Save the configuration
Test the connection using the Test Connection button to verify your API key is valid.
Product Configuration
Create a product in WHMCS that maps to your email archiving offering:
- Go to Setup > Products/Services > Products/Services
- Create a new product or edit an existing one
- On the Module Settings tab, select easymailarchive as the module
- Configure the module settings:
- Slug prefix (optional) - A prefix added to auto-generated slugs (e.g.,
mycompany-) - Auto-generate slug - When enabled, slugs are derived from the customer's domain or company name
- Slug prefix (optional) - A prefix added to auto-generated slugs (e.g.,
Automated Lifecycle Hooks
The module responds to the following WHMCS lifecycle events:
- Create - When a new service is activated, a tenant is provisioned via the API. The tenant slug and access URL are saved to the service and visible to the customer in the client area.
- Suspend - When a service is suspended (e.g., due to non-payment), the tenant is suspended via the API. Users lose access but data is preserved.
- Unsuspend - When a suspended service is reactivated (e.g., after payment), the tenant is unsuspended and access is restored.
- Terminate - When a service is terminated, the tenant is suspended (not deleted) to prevent accidental data loss. Contact Easy Mail Archive support for permanent deletion.
Client Area Integration
After provisioning, your customers see the following in their WHMCS client area:
- The archive access URL (their tenant subdomain)
- Current status (active or suspended)
- Quick link to log in to the archive
Usage Synchronization
The module can periodically sync usage data from the Easy Mail Archive API to WHMCS. This allows you to track active users and storage per tenant directly in your billing system. Configure a WHMCS cron hook to pull usage statistics daily or at your preferred interval.
Troubleshooting
If provisioning fails, check the following:
- API key - Verify the API key in the server configuration is correct and active
- Slug conflicts - The slug may already be taken. Check the WHMCS module log for error details.
- Network access - Ensure your WHMCS server can reach
api.easymailarchive.comon port 443 - Module logs - Check Utilities > Logs > Module Log in WHMCS for detailed error messages from the API