Getting Started
Connect your app to the Email Testing SMTP sink with an SMTP sink credential and capture test emails.
Authenticate your app to the Email Testing SMTP sink with an SMTP sink credential so test emails are captured instead of delivered to real recipients.
These credentials don't send email. SMTP sink credentials belong to the Maileroo Sandbox (Email Testing Platform). Your app uses them to connect to the sandbox SMTP sink, which intercepts and captures test emails instead of delivering them. To send real email, use SMTP Relay or the Email API.
SMTP and MX ingestion
The Email Testing SMTP host is smtp.sandbox.maileroo.io. Use port 465 for implicit TLS, or ports 587 and 2525 for STARTTLS. Authenticate your app to the Email Testing SMTP sink with an SMTP sink credential from List SMTP Sink Credentials or Create SMTP Sink Credential. These credentials authenticate your app so its test emails are captured; they are not SMTP Relay credentials for delivering mail to real recipients.
For a custom testing domain, publish an MX record pointing to mx.sandbox.maileroo.io, then use Verify Domain. The shared sandbox address domain is account-specific: the dashboard shows it, and List Domains and Get Usage return it as sandbox_domain. Do not hardcode a shared sandbox address domain in test code.
Send examples
Nodemailer
import nodemailer from "nodemailer";
const transport = nodemailer.createTransport({
host: "smtp.sandbox.maileroo.io",
port: 587,
secure: false,
auth: { user: process.env.MAILEROO_SMTP_USER, pass: process.env.MAILEROO_SMTP_PASSWORD },
});
await transport.sendMail({
from: "[email protected]",
to: process.env.MAILEROO_TEST_INBOX,
subject: "Email Testing",
text: "Captured by Maileroo.",
});PHPMailer
$mail->isSMTP();
$mail->Host = 'smtp.sandbox.maileroo.io';
$mail->Port = 587;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->SMTPAuth = true;
$mail->Username = getenv('MAILEROO_SMTP_USER');
$mail->Password = getenv('MAILEROO_SMTP_PASSWORD');
$mail->addAddress(getenv('MAILEROO_TEST_INBOX'));Python
import os
import smtplib
from email.message import EmailMessage
message = EmailMessage()
message["From"] = "[email protected]"
message["To"] = os.environ["MAILEROO_TEST_INBOX"]
message["Subject"] = "Email Testing"
message.set_content("Captured by Maileroo.")
with smtplib.SMTP("smtp.sandbox.maileroo.io", 587) as smtp:
smtp.starttls()
smtp.login(os.environ["MAILEROO_SMTP_USER"], os.environ["MAILEROO_SMTP_PASSWORD"])
smtp.send_message(message)Go
package main
import (
"net/smtp"
"os"
)
func main() {
host := "smtp.sandbox.maileroo.io"
auth := smtp.PlainAuth("", os.Getenv("MAILEROO_SMTP_USER"), os.Getenv("MAILEROO_SMTP_PASSWORD"), host)
to := os.Getenv("MAILEROO_TEST_INBOX")
msg := []byte("From: [email protected]\r\n" +
"To: " + to + "\r\n" +
"Subject: Email Testing\r\n" +
"\r\n" +
"Captured by Maileroo.\r\n")
// SendMail upgrades the connection with STARTTLS before authenticating.
if err := smtp.SendMail(host+":587", auth, "[email protected]", []string{to}, msg); err != nil {
panic(err)
}
}Rust
Using lettre:
use lettre::message::header::ContentType;
use lettre::transport::smtp::authentication::Credentials;
use lettre::{Message, SmtpTransport, Transport};
use std::env;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let email = Message::builder()
.from("[email protected]".parse()?)
.to(env::var("MAILEROO_TEST_INBOX")?.parse()?)
.subject("Email Testing")
.header(ContentType::TEXT_PLAIN)
.body(String::from("Captured by Maileroo."))?;
let mailer = SmtpTransport::starttls_relay("smtp.sandbox.maileroo.io")?
.port(587)
.credentials(Credentials::new(
env::var("MAILEROO_SMTP_USER")?,
env::var("MAILEROO_SMTP_PASSWORD")?,
))
.build();
mailer.send(&email)?;
Ok(())
}Laravel
Set these in your .env; Laravel's smtp mailer upgrades to STARTTLS on port 587 automatically:
MAIL_MAILER=smtp
MAIL_HOST=smtp.sandbox.maileroo.io
MAIL_PORT=587
MAIL_USERNAME=your-smtp-username
MAIL_PASSWORD=your-smtp-password
[email protected]
MAIL_FROM_NAME="${APP_NAME}"swaks
swaks --server smtp.sandbox.maileroo.io --port 587 --tls \
--auth LOGIN --auth-user "$MAILEROO_SMTP_USER" \
--auth-password "$MAILEROO_SMTP_PASSWORD" \
--from [email protected] --to "$MAILEROO_TEST_INBOX" \
--header "Subject: Email Testing" --body "Captured by Maileroo."