Send transactional email through DirectIQ from any application, framework or service that supports SMTP. No code changes are needed beyond your mail settings: point your SMTP client at DirectIQ and sign in with your API key.
Email sent over SMTP goes through the same pipeline as the Transactional Emails API. It uses the same credits, sender rules and reporting.
Connection settings
| Setting | Value |
|---|---|
| Host | smtp.directiq.com |
| Port | 587 (STARTTLS, recommended) or 465 (TLS) |
| Encryption | Required |
| Authentication | PLAIN or LOGIN |
| Username | api |
| Password | Your X-API-Key |
| Maximum message size | 25 MB, including attachments |
You can find your X-API-Key and these settings in DirectIQ under Integrations → SMTP.
Encryption is requiredThe server offers authentication only on an encrypted connection. On port
587, your client must issueSTARTTLSbefore it signs in. On port465, the connection is encrypted from the start.
Before you send
- Use a confirmed sender. The
Fromaddress must be a sender confirmed in your account. See Senders. - Have credits available. Each recipient in
Touses one transactional send. - Keep your key private. The SMTP password is your X-API-Key. If you regenerate it on the API Keys page, update your SMTP settings too.
Examples
Node.js (Nodemailer)
import nodemailer from "nodemailer";
const transporter = nodemailer.createTransport({
host: "smtp.directiq.com",
port: 587,
secure: false, // upgrades to TLS with STARTTLS
auth: {
user: "api",
pass: process.env.DIRECTIQ_API_KEY,
},
});
await transporter.sendMail({
from: '"Acme" <[email protected]>',
to: "[email protected]",
subject: "Your order has shipped",
html: "<p>Your order <strong>#1042</strong> is on its way.</p>",
});Python
import os
import smtplib
from email.message import EmailMessage
msg = EmailMessage()
msg["From"] = "Acme <[email protected]>"
msg["To"] = "[email protected]"
msg["Subject"] = "Your order has shipped"
msg.add_alternative("<p>Your order <strong>#1042</strong> is on its way.</p>", subtype="html")
with smtplib.SMTP("smtp.directiq.com", 587) as smtp:
smtp.starttls()
smtp.login("api", os.environ["DIRECTIQ_API_KEY"])
smtp.send_message(msg)PHP (PHPMailer)
use PHPMailer\PHPMailer\PHPMailer;
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.directiq.com';
$mail->Port = 587;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->SMTPAuth = true;
$mail->Username = 'api';
$mail->Password = getenv('DIRECTIQ_API_KEY');
$mail->setFrom('[email protected]', 'Acme');
$mail->addAddress('[email protected]');
$mail->isHTML(true);
$mail->Subject = 'Your order has shipped';
$mail->Body = '<p>Your order <strong>#1042</strong> is on its way.</p>';
$mail->send();C# (MailKit)
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
var message = new MimeMessage();
message.From.Add(new MailboxAddress("Acme", "[email protected]"));
message.To.Add(MailboxAddress.Parse("[email protected]"));
message.Subject = "Your order has shipped";
message.Body = new TextPart("html") { Text = "<p>Your order <strong>#1042</strong> is on its way.</p>" };
using var client = new SmtpClient();
await client.ConnectAsync("smtp.directiq.com", 587, SecureSocketOptions.StartTls);
await client.AuthenticateAsync("api", Environment.GetEnvironmentVariable("DIRECTIQ_API_KEY"));
await client.SendAsync(message);
await client.DisconnectAsync(true);cURL
curl --url "smtp://smtp.directiq.com:587" --ssl-reqd \
--user "api:$DIRECTIQ_API_KEY" \
--mail-from "[email protected]" \
--mail-rcpt "[email protected]" \
--upload-file email.emlHow messages are delivered
- One email per
Torecipient. A message with three addresses inTois delivered as three separate emails. Each one uses a send and gets its own report. - Cc and Bcc are copied on every email in the message. Recipients you add in the SMTP envelope but not in the
ToorCcheaders are treated as Bcc. - HTML is preferred. If a message has both an HTML part and a plain-text part, the HTML part is sent.
- Attachments are supported, within the 25 MB message limit.
- At least one address is required in the
Toheader.
Troubleshooting
| Problem | What to check |
|---|---|
530 Authentication required | Sign in before sending. On port 587, issue STARTTLS first. |
535 Authentication failed | The username must be exactly api, and the password must be your current X-API-Key. |
AUTH not offered | The connection isn't encrypted yet. Use STARTTLS on 587, or connect with TLS on 465. |
554 Transaction failed | No email could be created. Usually the From address isn't a confirmed sender, or your account has no credits left. |
| Connection timed out | Some hosting providers block outgoing SMTP ports. Try the other port, or ask your provider to open it. |
Prefer HTTP?If your platform blocks SMTP ports, or you need idempotency and delivery status, use the Transactional Emails API instead.

