Authenticated SMTP Relay
Route outbound emails from your development backend, framework, or Docker container to the Emailens sandbox SMTP server.
The Emailens SMTP Relay runs a dedicated SMTP gateway on port 2525 (with fallback port 587). It safely intercepts all outgoing mail from your application code and routes it into your dedicated sandbox inbox.
Emails routed through the relay are quarantined in your test environment. They never reach real mailboxes or external mail transfer agents.
SMTP Connection Details
Configure your mailer with the following parameters:
| Parameter | Setting | Description |
|---|---|---|
| Host | smtp.emailens.dev | Global relay hostname |
| Port | 2525 or 587 | Port 2525 is unblocked by cloud providers (AWS, GCP, DigitalOcean) |
| Security | STARTTLS | TLS 1.2+ encryption enforced in transit |
| Username | esmtp_... | Dedicated credential username generated for your inbox |
| Password | ... | Secret password generated for the credential |
Framework Integration Examples
Node.js (Nodemailer)
import nodemailer from "nodemailer";
const transporter = nodemailer.createTransport({
host: "smtp.emailens.dev",
port: 2525,
secure: false, // upgrades via STARTTLS
requireTLS: true,
auth: {
user: process.env.EMAILENS_SMTP_USER, // e.g. esmtp_clx9abc123
pass: process.env.EMAILENS_SMTP_PASS,
},
});
await transporter.sendMail({
from: '"Acme App" <[email protected]>',
to: "[email protected]",
subject: "Your one-time login code",
html: "<p>Your code is <strong>482910</strong></p>",
});PHP / Laravel
In your .env:
MAIL_MAILER=smtp
MAIL_HOST=smtp.emailens.dev
MAIL_PORT=2525
MAIL_USERNAME=esmtp_your_username
MAIL_PASSWORD=your_generated_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"In config/mail.php, Laravel defaults to STARTTLS when MAIL_ENCRYPTION=tls and MAIL_PORT=2525.
Python (smtplib & Django)
Using standard Python smtplib:
import smtplib
from email.message import EmailMessage
msg = EmailMessage()
msg.set_content("Your confirmation code is 882910")
msg["Subject"] = "Welcome to our platform"
msg["From"] = "[email protected]"
msg["To"] = "[email protected]"
with smtplib.SMTP("smtp.emailens.dev", 2525) as server:
server.starttls()
server.login("esmtp_your_username", "your_generated_password")
server.send_message(msg)In Django settings.py:
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.emailens.dev"
EMAIL_PORT = 2525
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.environ.get("EMAILENS_SMTP_USER")
EMAIL_HOST_PASSWORD = os.environ.get("EMAILENS_SMTP_PASS")Ruby on Rails
In config/environments/development.rb:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.emailens.dev',
port: 2525,
user_name: ENV['EMAILENS_SMTP_USER'],
password: ENV['EMAILENS_SMTP_PASS'],
authentication: 'plain',
enable_starttls_auto: true
}Go (net/smtp)
package main
import (
"crypto/tls"
"net/smtp"
)
func main() {
auth := smtp.PlainAuth("", "esmtp_your_username", "your_password", "smtp.emailens.dev")
to := []string{"[email protected]"}
msg := []byte("To: [email protected]\r\nSubject: Test Email\r\n\r\nHello from Go!")
err := smtp.SendMail("smtp.emailens.dev:2525", auth, "[email protected]", to, msg)
if err != nil {
panic(err)
}
}Safe Delivery Guarantee
The Emailens SMTP relay acts as a dead-end sink:
- Outbound delivery to external Mail Transfer Agents (MTAs) is impossible by architecture.
- Any recipient address (e.g.
[email protected]or[email protected]) will be safely routed into your staging inbox instead of escaping to the internet. - MIME payloads and attachments are parsed in-memory and committed to your isolated tenant database.