SMTP Relay
MoSend's SMTP relay is a drop-in for any framework or app that already sends email over SMTP. No code changes: just replace the connection details.
Connection details
| Host | smtp.mosend.dev |
| Ports | 587 (STARTTLS) or 465 (TLS). |
| Username | The literal word 'apikey'. |
| Password | Your MoSend API key. |
Examples
import nodemailer from 'nodemailer';
const transporter = nodemailer.createTransport({
host: 'smtp.mosend.dev',
port: 587,
secure: false, // STARTTLS
auth: {
user: 'apikey',
pass: process.env.MOSEND_API_KEY,
},
});
await transporter.sendMail({
from: 'hola@tudominio.com',
to: 'usuario@ejemplo.com',
subject: 'Welcome',
html: '<h1>Hi</h1>',
}); import os, smtplib
from email.mime.text import MIMEText
msg = MIMEText("<h1>Hi</h1>", "html")
msg["Subject"] = "Welcome"
msg["From"] = "hola@tudominio.com"
msg["To"] = "usuario@ejemplo.com"
with smtplib.SMTP("smtp.mosend.dev", 587) as s:
s.starttls()
s.login("apikey", os.environ["MOSEND_API_KEY"])
s.send_message(msg) // PHPMailer
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.mosend.dev';
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Username = 'apikey';
$mail->Password = getenv('MOSEND_API_KEY'); TLS
We recommend port 587 with STARTTLS. All connections are encrypted; plain-text connections are rejected.