# SMTP

Any application that can send mail over SMTP can send through Voozin: CMSs, helpdesks, printers, cron jobs and mail clients. SMTP sends from a mailbox, so the sender address is the mailbox you sign in with. For high-volume app email, prefer the [REST API](https://voozin.com/docs/sending), which adds templates, idempotency, tags and delivery webhooks.

## Settings

| Setting | Value |
| --- | --- |
| Host | `smtp.inboxcluster.net` (the **Connect** dialog shows the host for your account) |
| Port | `465` with SSL/TLS, or `587` with STARTTLS |
| Authentication | Normal password (`PLAIN` or `LOGIN`) |
| User name | The full mailbox address, for example `no-reply@acme.com` |
| Password | An app password for that mailbox |

Connections without TLS are refused.

## Create a sending mailbox and app password

1. In the dashboard open **Mailboxes** and create a mailbox for the application, for example `no-reply@acme.com`. A **standard** encryption mode mailbox is the simplest choice for application mail.
2. Click **Connect** next to the mailbox and create an app password. It is shown once.
3. Enter the settings above in your application.

Revoke the app password from the same dialog if it leaks. Repeated wrong passwords temporarily block the client's IP address.

## Rules

- The `MAIL FROM` address must be the authenticated mailbox. To send as several addresses, create a mailbox for each.
- Each mailbox and organization has an hourly recipient limit, and suppressed addresses (hard bounces, complaints) are refused.
- Sent messages are stored in the mailbox's Sent folder.

## Examples

Node.js with Nodemailer:

```ts
import nodemailer from "nodemailer";

const transport = nodemailer.createTransport({
  host: "smtp.inboxcluster.net",
  port: 465,
  secure: true,
  auth: { user: "no-reply@acme.com", pass: process.env.VOOZIN_SMTP_PASSWORD },
});

await transport.sendMail({ from: "Acme <no-reply@acme.com>", to: "ada@example.com", subject: "Hello", text: "Hi Ada" });
```

PHP with PHPMailer:

```php
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.inboxcluster.net';
$mail->Port = 587;
$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
$mail->SMTPAuth = true;
$mail->Username = 'no-reply@acme.com';
$mail->Password = getenv('VOOZIN_SMTP_PASSWORD');
$mail->setFrom('no-reply@acme.com', 'Acme');
$mail->addAddress('ada@example.com');
$mail->Subject = 'Hello';
$mail->Body = 'Hi Ada';
$mail->send();
```

For WordPress, use the [Voozin plugin](https://voozin.com/docs/wordpress) instead of an SMTP plugin: it sends over the API and adds a delivery log and inbound mail.
