# SMTP

> Send through smtp.vaartix.com from WordPress, Laravel, Django, Nodemailer or any app that speaks SMTP.

Source: https://vaartix.com/docs/sending/smtp/

If your app can only send email over SMTP, point it at Vaartix’s SMTP relay. Each message becomes the same email as a [`POST /emails`](https://vaartix.com/docs/sending/emails/) request: your verified domain, daily limit, suppression list, webhooks and logs all work the same way.

## Settings

| Setting | Value |
| --- | --- |
| Host | `smtp.vaartix.com` |
| Port | `465` (SSL/TLS) or `587` (STARTTLS) |
| Encryption | Required. `465`: SSL/TLS. `587`: STARTTLS (sometimes labelled “TLS”) |
| Username | `vaartix` |
| Password | An [API key](https://vaartix.com/docs/concepts/api-keys/), such as `vx_live_...` |
| Authentication | Required (PLAIN or LOGIN) |

Use a **send-only** key, made for this app, so you can revoke it on its own. The **From** address must be on a domain your team has [verified](https://vaartix.com/docs/domains/verify/), or at `test.vaartix.com` to [test](https://vaartix.com/docs/sending/test-mode/).

To send as `support@yourdomain.com` from Gmail (**Send mail as**), Outlook, Apple Mail or Thunderbird, follow [Send from Gmail with your own domain](https://vaartix.com/docs/guides/gmail-send-as/).

Vaartix refuses to log in without TLS, so your API key never crosses the network in plain text. On port 587, the client must send STARTTLS first. Port 25 is not available.

## Examples

**WordPress**

The [Vaartix plugin](https://vaartix.com/docs/guides/wordpress/) is the simplest way to send from WordPress. If you prefer SMTP, or can’t install plugins from a zip, install [WP Mail SMTP](https://wordpress.org/plugins/wp-mail-smtp/) and go to **WP Mail SMTP** → **Settings**:

1.  **From Email**: an address on your verified domain, for example `hello@acme.in`. Tick **Force From Email** so plugins can’t send from other addresses.
2.  **From Name**: your site or company name.
3.  **Mailer**: **Other SMTP**.
4.  **SMTP Host** `smtp.vaartix.com`, **Encryption** **SSL**, **SMTP Port** `465`. (Or **TLS** with port `587`.)
5.  **Auto TLS**: on. **Authentication**: on.
6.  **SMTP Username** `vaartix`, **SMTP Password** your API key.
7.  **Save Settings**, then send a test from the **Tools** → **Email Test** tab.

To keep the key out of the database, put it in `wp-config.php` instead:

```php
define( 'WPMS_ON', true );
define( 'WPMS_MAILER', 'smtp' );
define( 'WPMS_SMTP_HOST', 'smtp.vaartix.com' );
define( 'WPMS_SMTP_PORT', 465 );
define( 'WPMS_SSL', 'ssl' );
define( 'WPMS_SMTP_AUTH', true );
define( 'WPMS_SMTP_USER', 'vaartix' );
define( 'WPMS_SMTP_PASS', 'vx_live_...' );
```

## How messages are read

| In the message | Becomes |
| --- | --- |
| `From` header | `from`. Its domain must be verified for your team. |
| `To` and `Cc` headers | `to` and `cc` |
| Envelope recipients (`RCPT TO`) not in `To` or `Cc` | `bcc`. This is how SMTP clients send blind copies. |
| `Reply-To`, `Subject` | `replyTo`, `subject` |
| HTML and plain-text parts | `html` and `text` |
| Attachments | `attachments`. Inline images keep their `Content-ID`, so `cid:` links in the HTML still work. |
| `X-Vaartix-Tags: type=order, plan=pro` | `tags`: `[{"name":"type","value":"order"},{"name":"plan","value":"pro"}]`. The header itself isn’t sent. |
| Other headers, such as `List-Unsubscribe` or `X-Campaign` | `headers`, sent as they are |

Headers Vaartix sets itself (`Message-ID`, `Date`, `Return-Path`, `DKIM-Signature` and the like) are replaced. The envelope sender (`MAIL FROM`) is ignored: bounces always go to Vaartix, so it can update the email’s status and your suppression list.

The return path is your domain’s `vxmail.` subdomain, such as `vxmail.acme.in` (or `vx-bounces.acme.in` on older domains), the same as for the API. Gmail shows it as **mailed-by** under “Show details”; recipients see your From address and **Signed by** your domain. See [The return path](https://vaartix.com/docs/domains/verify/#the-return-path).

A message needs at least one address in `To` or `Cc`. Messages of up to **40 MB** are accepted, with at most 50 recipients and 30 MB of attachments, the same as the API.

When Vaartix accepts a message, it replies `250 2.0.0 Queued as em_...`. That email ID is in the dashboard’s **Emails** page and in webhook events. Each message also appears in **Logs** with the method `SMTP` and the reply code.

## Errors

Vaartix answers with standard SMTP codes, so your app or plugin knows whether to try again. `4xx` codes are temporary: well-behaved clients retry later. `5xx` codes are permanent: fix the cause before sending again.

| Code | Meaning | What to do |
| --- | --- | --- |
| `535` | Wrong username or API key, or the key was revoked | Username `vaartix`, password a current API key |
| `538` | Login attempted before STARTTLS | Turn on TLS (port 587) or SSL (port 465) |
| `454` | Too many failed logins: locked for 30 minutes | Fix the password, then wait |
| `550` | The From domain isn’t verified (`domain_not_verified`), the recipient is [suppressed](https://vaartix.com/docs/concepts/suppression/), the key is limited to another domain, or sending is paused | Read the message after the code |
| `554` | The message is invalid, for example no subject or a blocked attachment type | Read the message after the code |
| `552` | Larger than 40 MB | Send smaller attachments, or links to them |
| `452` | Daily or monthly limit reached, or more than 50 recipients | Try again after midnight IST, or [upgrade](https://vaartix.com/docs/concepts/limits/) |
| `421` | More than 10 messages a second for this key (one budget with the API), or more than 3 messages being sent at once from your address | Slow down, or send from fewer connections at once; the client reconnects and retries |
| `451` | Something went wrong on our side | Retry; your client does this by itself |

10 failed logins from one IP address, or 5 with the same API key prefix, within 15 minutes lock that address or key out of SMTP for 30 minutes, even with the right key. The API isn’t affected.
