MailCraft
Home Pricing Docs
Integration

SMTP Submission (Port 587 STARTTLS)

Connect Nodemailer, Python, Laravel, or any standard mail library using mandatory STARTTLS on port 587.

Connection Parameters

Setting Production Local Dev
Host smtp.mailcraft.local localhost
Port 587 2525
Encryption STARTTLS (mandatory before AUTH) Optional (SMTP_ALLOW_INSECURE_AUTH=true)
Authentication AUTH PLAIN or AUTH LOGIN AUTH PLAIN / LOGIN
Username / Password Generated in Mail Agents Generated in Mail Agents

Security & Enforcement Rules

  • Mandatory STARTTLS: In production, AUTH is not advertised until TLS is negotiated.
  • Strict Tenant Domain Alignment: Both the envelope MAIL FROM domain and the MIME From: header domain must belong to the authenticated Mail Agent; otherwise the server rejects with 550 5.7.1.
  • Atomic Credit Check: Credits are checked and deducted when DATA completes. Insufficient credits return 550 5.7.0 Insufficient credits.

Example: Node.js (Nodemailer)

import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
  host: 'smtp.mailcraft.local',
  port: 587,
  secure: false, // Upgrade via STARTTLS on port 587
  requireTLS: true,
  auth: {
    user: 'smtp_agent_username',
    pass: 'YOUR_SMTP_PASSWORD',
  },
});

await transporter.sendMail({
  from: '"Example App" <no-reply@mail.example.com>',
  to: 'customer@example.org',
  subject: 'Payment Receipt',
  text: 'Thank you for your payment.',
  html: '<p>Thank you for your payment.</p>',
});

Example: Python (smtplib)

import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["Subject"] = "Password Reset"
msg["From"] = "no-reply@mail.example.com"
msg["To"] = "user@example.org"
msg.set_content("Click the link to reset your password.")

with smtplib.SMTP("smtp.mailcraft.local", 587) as server:
    server.starttls()
    server.login("smtp_agent_username", "YOUR_SMTP_PASSWORD")
    server.send_message(msg)