Generic SMTP
Email Partner
Overview
CleverTap supports integrating any Email Service Provider (ESP) using the SMTP protocol to send Email campaigns.
Integrate Email Service Provider
To integrate the ESP with CleverTap, follow these steps:
- Go to Settings > Email from the dashboard and click + Provider.
- Select SMTP from the Provider dropdown.
- Enter the following details:
Field | Description |
---|---|
Nickname | A unique name to identify your SMTP configuration within the CleverTap dashboard. |
Callback URL | The URL where CleverTap will receive the bounce, rejection, and subscription information from the ESP. This is a read-only field that is auto-populated with CleverTap's callback URL. For more information, refer to SMTP Callbacks. |
Host | Enter the publicly accessible IP address or hostname of your SMTP server. |
Port | Enter the SMTP port value. |
Scheme | Select the security protocol for your SMTP connection (for example, SMTP/SMTPS). |
Username and Password | Enter the Username and Password values that must be your SMTP credentials needed to connect to the service. |
Default From Name | The senderβs name will appear in the recipient's inbox, helping them identify the sender of the email. |
From Address | Enter the senderβs email address. Most people do not open an email unless they recognize the sender. |
Reply Address | The email address where replies from recipients are sent. Ensure this is monitored for effective communication. |
Email Preference Center | A landing page where users can manage their email preferences, including opting out or selecting specific types of emails. You can also use CleverTap's system preference center. You can select from the following options: None, CleverTap Preference Center, and Custom URL. |
- Click Save to save your settings.
- Click Send a test email. After the setup is complete, you will receive an email in your inbox. If you do not receive the email, refer to Troubleshooting.
SMTP Callbacks
SMTP Callbacks provide insights into delivery success, failures, unsubscribes, and spam reports of your SMTP email provider. These insights help optimize strategies and improve email campaign performance through the following:
- Notification Failed Event: The Notification Failed event is raised to track delivery issues such as hard and soft bounces. The type parameter in this event specifies the reason for the failure, such as hard bounce, soft bounce, spam, or unsubscribed.
- Profile Unsubscribes: When users unsubscribe, mark emails as spam, or experience a hard bounce (excluding soft bounces), their profiles are automatically unsubscribed from future communications, triggering the Channel Unsubscribed event.
Callback requests must be made to CleverTap's Callback URL. The ESP must add this URL to their Email Provider Settings to pass these callback events. You can find the CleverTap Callback URL under the Provider Setup tab on the CleverTap dashboard.

Callback URL for Provider Setup
Configure SMTP Callback
In the outgoing email SMTP payload, CleverTap sends the X-CleverTap_META
key with a specific value. The provider must send the same value in the callback payload to CleverTap's callback URL within the meta
key. When received along with the incoming callback payload, this helps attribute a callback to a specific profile and campaign.
Send Callback Events
To send callback events to CleverTap, customers must send a POST request to CleverTap's Callback URL. The following is a sample callback payload:
{
"version": "v2",
"events": {
"failed": [
{
"type": "unsubscribed", // Indicates the reason for failure, in this case, the user has unsubscribed
"email": "user1@example.com", // The email address of the affected user
"meta": "user1@example.com|1568798080|1730714617|20241104|0|wzrk_default|-17005907|",
"description": "Hard bounce detected" // Additional details of the failure reason
},
{
"type": "hard_bounce",
"email": "user3@example.com",
"meta": "user3@example.com|1568798080|1730799638|20241105|0|wzrk_default|-17005910|",
"description": "Hard bounce detected"
},
{
"type": "soft_bounce",
"email": "user5@example.com",
"meta": "usert5@example.com|1568798080|1730714617|20241104|0|wzrk_default|-17005905|",
"description": "Recipient Inbox Full"
},
{
"type": "spam",
"email": "user4@example.com",
"meta": "user4@example.com|1568798080|1730714617|20241104|0|wzrk_default|-17005904|",
"description": "Marked as spam"
}
]
}
}
The following table provides a brief description of the keys present in the callback payload:
Key | Description | Required/Optional | Sample Values |
---|---|---|---|
version | Denotes the payload version. This must be set to v2 to track the delivery-related information such as success, failures, unsubscribes, and spam reports. | Required | v2 |
event | Denotes the event name. | Required | failed |
type |
| Required | soft_bounce |
Denotes the email address of the recipient. | Required | user1@example.com | |
meta | CleverTap sends the key X-CleverTap_META in the SMTP payload with a specific value. The provider must return this value as is, in the callback payload under the meta key to properly attribute the callback to the correct profile and campaign. | Required | Replacement - X-CleverTap_META For example, user1@example.com|1568798080|1730714617|20241104|0|wzrk_default|-17005904| |
description | An optional field to add more descriptive information regarding the callback event for analysis, such as the User unsubscribed .This is included in the reason event property of the Channel Unsubscribed event, with the description offering additional details for error analysis. | Optional | Soft bounce detected Denotes that the email to the intended user resulted in a soft bounce. |
Note
If the payload includes additional key-value pairs apart from the ones that are defined in the acceptable sample payload for each event, CleverTap does not throw any errors, but simply disregards those.
Incoming Payload Mapping to System Events
CleverTap maps the following incoming payloads with their respective system events:
- Notification Failed: This event is raised if the callback event field
type
has values such ashard_bounce
orsoft_bounce
. The event propertyError
of the Notification Failed event specifies the type of failure, that is, hard bounce or soft bounce.

Payload Mapping for Notification Failed Event
- Channel Unsubscribed: This event is raised if the callback event field
type
has values such asunsubscribed
,spam
, orbounce
. The event property Type of the Channel Unsubscribed event specifies the reason for profile unsubscription.

Payload Mapping for Channel Unsubscribed Event
Response Codes
CleverTap sends the following status codes and descriptions as a response to the ESP upon receiving callbacks:
Status Code | Description | Explanation |
---|---|---|
200 | - | Success |
400 | Bad request. Some mandatory parameters were missing. | This occurs when any mandatory keys are missing from the payload or when the payload format is incorrect. |
More than allowed events received. | This occurs if more than 1000 events are sent in a single API call. | |
500 | Server error | CleverTap internal server error. Contact CleverTap support if the issue persists. |
Sample Response
The following is the sample response sent by CleverTap to the provider upon processing the callback payload successfully:
{
"TOTAL_EVENTS": 4,
"PROCESSED_EVENTS": 4,
"UNPROCESSED_EVENTS": []
}
The following is the sample response sent by CleverTap to the providers upon partial processing of callback events:
{
"error": "2 event(s) failed to process",
"TOTAL_EVENTS": 4,
"PROCESSED_EVENTS": 2,
"UNPROCESSED_EVENTS": [
{
"type": "hard_bounce",
"email": "user1@clevertap.com",
"description": "User hard bounce",
"errorDescription": "invalid meta"
},
{
"email": "user2@clevertap.com",
"meta": "user2@clevertap.com|1568798080|1733728287|20241209|0|wzrk_default|-17006141|",
"description": "User soft bounce",
"errorDescription": "Could not map event to any bounce type"
}
]
}
The following is the sample error response:
{
"error": "Exception occurred while reading input stream",
"TOTAL_EVENTS": 0,
"PROCESSED_EVENTS": 0,
"UNPROCESSED_EVENTS": []
}
Handle Bounces
When a recipientβs email server rejects an email, it is called a bounce. There are two types of bounces:
- Soft Bounces: Soft bounces typically indicate a temporary delivery issue to an address. Some reasons for a soft bounce could be that the recipientβs mailbox is full or the Mail Server is down. Soft bounces are included in the campaign reports; the users are not marked unsubscribed.
- Hard Bounces: A hard bounce indicates a permanent reason an email cannot be delivered. Hard bounces are included in the campaign reports; the users are marked as unsubscribed.
To handle bounced email messages, you must make an HTTP request to the callback URL specified under the Setup tab of Settings > Channels > Email page on the CleverTap dashboard.
Handle Unsubscriptions
To share unsubscription data from custom pages directly, you need to make an HTTP request to the callback URL specified under the Setup tab of Settings > Channels > Email page on the CleverTap dashboard.
For more information about handling unsubscription requests from users, refer to Handling Unsubscribes.
Troubleshooting
- As you are using your SMTP gateway, some email providers, such as Gmail and Yahoo, might not deliver the email to your inbox.
- Check if you have set up DKIM and SPF correctly.
- Check if Spamhaus has blacklisted your IP/domain.
Unsubscription Link
The Unsubscribe link does not work test emails sent when creating an email cmapign.
Errors
The following table lists the errors that you may encounter after sending a campaign:
Error Message | Cause | Resolution |
---|---|---|
SMTP invalid email ID | ||
Cause 1 The SMTP invalid email ID error occurs when the provided email address is not formatted correctly or does not exist. Typos or errors in the email address commonly cause this error. | Double-check the email address and ensure the email ID is valid to fix this error. | |
Cause 2 This error can also occur if you are using a test email address. | CleverTap recommends using an actual email address. If the issue persists, contact your ESP's customer support for further assistance. | |
SMTP dispatching failed | To fix this error, check the recipient's email address and ensure that it is valid and that the email infrastructure is working correctly. If the issue persists, contact your provider's customer support. | |
SMTP connection error | If the issue persists, contact your ESP's customer support for further assistance. | |
SMTP timeout | If the issue persists, contact your ESP's customer support for further assistance. |
Updated 22 days ago