# Send email from your app

> Send order confirmations, contact-form mail and other app email through a veldhost mailbox with an Email API key.

Source: https://veldhost.eu/docs/send-email-from-your-app

Last verified: 2026-11-16

Your app sends mail over SMTP, signed in as one mailbox with an Email API key that may **Send mail**. Mail goes out through veldhost's mail server, signed for your domain, so it reaches inboxes the same way your own mail does.

## Before you start

[Create an Email API key](https://veldhost.eu/docs/email-api-keys) with **Send mail** on the mailbox the app should send as, and keep the key at hand.

## Settings

| Setting | Value |
|---|---|
| Server | smtp.veldhost.eu |
| Port | 2525 |
| Security | STARTTLS |
| Username | the mailbox address, for example `noreply@example.com` |
| Password | the Email API key |

The app may send as the mailbox address and as its aliases. Mail with any other sender address is refused.

## Examples

In each example, `MAILBOX` is the mailbox address, `KEY` the Email API key, `SMTP_HOST` stands for smtp.veldhost.eu and `SMTP_PORT` for 2525. Keep the key out of your code repository: put it in an environment variable or your app's secret settings.

**Laravel** (`.env`):

```
MAIL_MAILER=smtp
MAIL_HOST=SMTP_HOST
MAIL_PORT=SMTP_PORT
MAIL_ENCRYPTION=tls
MAIL_USERNAME=MAILBOX
MAIL_PASSWORD=KEY
MAIL_FROM_ADDRESS=MAILBOX
```

**WordPress**: install an SMTP plugin, choose "Other SMTP", and enter the server, port 2525, TLS (STARTTLS), authentication on, the mailbox address as username and the key as password. Set the "From" address to the mailbox address.

**Node.js** (nodemailer):

```js
const transporter = nodemailer.createTransport({
  host: 'SMTP_HOST', port: SMTP_PORT, secure: false, requireTLS: true,
  auth: { user: 'MAILBOX', pass: process.env.EMAIL_API_KEY },
});
await transporter.sendMail({ from: 'MAILBOX', to: 'customer@example.org', subject: 'Your order', text: 'Thank you!' });
```

**Python**:

```python
import os, smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["From"], msg["To"], msg["Subject"] = "MAILBOX", "customer@example.org", "Your order"
msg.set_content("Thank you!")
with smtplib.SMTP("SMTP_HOST", SMTP_PORT) as smtp:
    smtp.starttls()
    smtp.login("MAILBOX", os.environ["EMAIL_API_KEY"])
    smtp.send_message(msg)
```

**PHP** (PHPMailer): `Host` = SMTP_HOST, `Port` = SMTP_PORT, `SMTPSecure` = `PHPMailer::ENCRYPTION_STARTTLS`, `SMTPAuth` = true, `Username` = MAILBOX, `Password` = the key.

## Limits

- The mailbox's sending limits apply, and are shared with everyone who sends from that mailbox. A dedicated mailbox for the app keeps them apart.
- A message has at most 25 recipients.
- Each month the first 1,000 messages sent with Email API keys are included; after that they are billed per message within your account's monthly **Spend cap** ([Email API pricing](https://veldhost.eu/docs/email-api-pricing)). When the account reaches its cap, sending with keys pauses until the next month or until you raise the cap.

This is for the mail your app sends to its own customers and users. Newsletters and bulk marketing to purchased or scraped lists are not allowed.

## When mail is refused or lands in spam

- **535 authentication failed**: the key is wrong, revoked or expired; it is not allowed **Send mail**; your server's address is not in **Allowed from**; the account's spend cap paused sending; or the app uses port 587 or 465 instead of 2525.
- **Sender address refused**: send as the mailbox address or one of its aliases.
- **Lands in spam**: see [Email goes to spam](https://veldhost.eu/docs/email-goes-to-spam). A clear subject, a real "From" name and a working reply address help.

## Related

- [Email API keys](https://veldhost.eu/docs/email-api-keys)
- [Read email from your app](https://veldhost.eu/docs/read-email-from-your-app)
- [Email API pricing](https://veldhost.eu/docs/email-api-pricing)