Tovanix
Tovanix

Using the SMTP aggregation API

Combine several of your own SMTP accounts into one outbound path, with the platform rotating between them:

  • The Free plan is activated automatically on first use; quota, available features and limits depend on the plan, you switch with "Change plan", and unused time is credited at the original price
  • Add accounts under SMTP Accounts first, then create a key under API Keys; creating and resetting both require identity verification, and the key is shown only once
  • Three ways to send: compose online, campaigns and API calls; campaigns merge and deduplicate automatically and skip the unsubscribe list
  • An SMTP account that fails 3 times in a row because of a problem with the account itself changes to "Error", and is restored automatically once the platform's test passes
  • Common errors: act on the message for 400 (quota used up, recipient already reported as bounced, and so on); 401 means the key is invalid, 403 means the account is restricted, and 429 means too many requests

What this service does

The SMTP aggregation API combines several of your own SMTP sending accounts into one outbound path: your system integrates with the platform once, and the platform rotates sending across those accounts. You can send directly from the console, or from your own system over the API.

  • It suits transactional mail such as signup codes and order notices, and equally bulk sends to contact groups.
  • The Free plan is activated automatically the first time you use the service. Once you add an SMTP account and create an API Key you can send; switch plans when you need more quota or features.
  • It lives under SMTP Aggregation API in the console, with its pages in three groups: Sending, Integration and Config.

A few terms first

This section has a lot of pages. Getting these concepts straight first makes it far harder to end up on the wrong one.

  • Plan — Sets how many emails you can send per day and per month, which features you can use (email templates, contacts, campaigns, webhooks) and the limit on each, as listed item by item on the cards on the Subscribe page. The Free plan is activated automatically the first time you use the service; when a paid plan expires, you return to the Free plan.
  • SMTP account — Your own SMTP sending account (from an email provider or your own server); the platform does not provide a sending channel. You can add several, each with its own priority and daily sending limit, and the platform rotates between them.
  • API Key — The credential your system uses to call the send endpoint. An API Key answers "who is calling"; an SMTP account answers "which mailbox sends".
  • Sending domain — The domain after the @ in your sending address. On the Sending Domains page, check its SPF, DKIM and DMARC records; with all of them in place, your mail is more likely to reach the inbox.
  • Unsubscribe list — Addresses that unsubscribed through an unsubscribe link, plus addresses your system reported through the API as bounced or as complaints. The platform skips these addresses automatically based on the list, so there is nothing for you to maintain by hand.

Getting your first email through

  • Check your plan: The Free plan is activated automatically the first time you open the service. Under SMTP Aggregation API → Subscribe you can see your current plan and the quota of each plan; subscribe to a higher tier when you need more quota or features.
  • Add an SMTP account: On the SMTP Accounts page, click "Add Account" and enter the host, port, username, password and sending address. How many you can add depends on your plan, and when you add several the platform rotates between them automatically.
  • Create an API Key: On the API Keys page, click "Create API Key". Creating and resetting both require identity verification first: enter the dynamic code if you have two-factor authentication on, or an email code if not; after verifying once, you will not be asked again for 10 minutes in the same session. The key is shown only once, so copy and save it immediately; each account can have up to 50 keys.
  • Send a test mail: On the SMTP Accounts page, click "Test" to test the connection or send a test email to your own address. Test emails do not use sending quota, so feel free to try several times.

If you already have a paid plan, switch by picking another tier on the Subscribe page and clicking "Change plan"; it takes effect immediately. The unused time on your current plan is credited at its original price, so you pay only the difference; any credit beyond the new plan's price is converted into extra time rather than refunded to your balance. Quota already used this month carries over to the new plan.

Once an API Key is deleted, every request still using it fails; resetting likewise invalidates the original key immediately. For a key a live system depends on, put the new one in place before touching the old one.

Three ways to send

One quota, three routes — pick by situation:

  • Compose online — Write and send from the console. Good for one-off notices and manual resends.
  • Campaign — Pick a template and contact groups to send in bulk, with throttling, tracking and scheduling. The system merges and deduplicates, and drops anyone on the unsubscribe list.
  • API call — Your system calls the endpoint directly. One request can address several recipients, each carrying its own template variables.

Templates and variables

Put the content in a template and pass only variables at send time, and content stops being tangled up with code.

  • Templates are maintained on the Templates page and referenced by identifier at send time; the platform performs the substitution.
  • The platform derives a plain-text fallback from the HTML, so the mail is still readable where HTML is not.

Contacts and unsubscribes

The Contacts page manages addresses and groups and supports CSV import and export; campaigns choose their recipients by group.

  • Selecting several groups merges and deduplicates them, so nobody receives the same mail twice.
  • When you import a CSV, addresses that have unsubscribed are skipped automatically.
  • The unsubscribe link leads to a confirmation page; confirming writes the address to the unsubscribe list and marks the contact.

The unsubscribe list applies automatically. Addresses reported as bounced or as complaints receive no mail of any kind; addresses that unsubscribed through an unsubscribe link are skipped only in campaigns and bulk sends, while single emails such as verification codes are still delivered.

Sending domains

On the Sending Domains page, add the domain you send from (the part after the @ in your sending address); you can also enter a DKIM selector (provided by your email provider). The platform checks the SPF, DKIM and DMARC records and gives the DNS records it recommends adding, along with a health rating. With the records in place, your mail is more likely to reach the inbox. This step is not required for sending; how many domains you can add depends on your plan.

Webhooks and events

To know what became of each message, configure a webhook and the platform calls your service back with delivery events.

  • Events cover the delivery process and its outcome, and also moments such as a recipient unsubscribing or a campaign finishing.
  • Callbacks are signed, and your server must verify the signature before trusting one — this step is the security boundary, so do not skip it.

Common errors and what to do

When an API call fails, check the HTTP status code and the message in the response first, then use the table below.

  • 400 returned — The request was refused: quota used up, the recipient was already reported as bounced or as a complaint, no usable SMTP account, invalid parameters, and so on — Act on the message. If quota is used up, wait for the reset (the daily quota resets at 00:00 in your account's time zone, which you can change in account settings; the monthly quota resets at the start of each month) or switch to a higher plan. If it says there is no usable SMTP account, check the accounts' status on the SMTP Accounts page.
  • 401 returned — No API Key was sent, or the key is invalid, disabled, deleted or reset — Check its status on the API Keys page and replace the key in your system with the one that is currently valid.
  • 403 returned — The account is frozen or restricted — A restricted account (error code 4031) can still call query endpoints, but sending is refused. Contact support to resolve it.
  • 429 returned — Too many requests: at most 20 per second per API Key, and 60 per second per account in total — Wait for the time given in the Retry-After response header before sending again. To mail many people, use a single request with several recipients or a campaign rather than rapid one-by-one calls.
  • Mail sends but lands in spam — Sending domain unconfigured, or content triggering filters — Check SPF, DKIM and DMARC on the Sending Domains page and add the DNS records it recommends, then review the content; before a real campaign, you can run it through "Delivery Rehearsal" first.

If an SMTP account fails to send 3 times in a row because of a problem with the account itself, such as a login failure or being unable to reach the server, its status changes to "Error" and it stops taking part in rotation. The platform tests it automatically on a schedule and restores it once a test passes. You can also test the connection or send a test email from the SMTP Accounts page, and it is restored as soon as one succeeds; or correct the connection details, or enable it manually.

Frequently Asked Questions

Everything is configured — why can I still not send?

Check in this order: whether SMTP Accounts has an enabled account (accounts with "Error" status do not send); whether the API Key in use is the one that is currently valid; and whether the daily or monthly quota is used up. The message returned by the API states the exact reason.

Does a test email use quota?

No. Test sends from the SMTP Accounts page do not use sending quota, so you can try freely while configuring.

What happens when a paid plan expires?

When it expires, your account returns to the quota and features of the Free plan. To keep using it, click "Renew" on the Subscribe page before it expires, or subscribe again after it expires.

Related pages: Help Center · Guides & FAQ · SMTP Aggregation API · API Documentation

Loading…