Complete instructions for setting up your email client or application to use Smarthost.MX as your SMTP relay service.
Professional email delivery
SMTP Server: | smtp.smarthost.mx |
Port: | 587 |
Encryption: | STARTTLS/TLS |
Authentication: | Required |
SMTP Server: | smtp.smarthost.mx |
Port: | 465 |
Encryption: | SSL/TLS |
Authentication: | Required |
smtp.smarthost.mx
. Check the top of your Dashboard for your specific SMTP server address.
Username:[email protected]
Password:your-generated-password
When configuring your application, the "From" email address must exactly match the verified email address associated with your SMTP credentials. Using mismatched addresses will result in authentication failures.
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
$mail = new PHPMailer(true);
// Server settings
$mail->isSMTP();
$mail->Host = 'smtp.smarthost.mx';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'your_smtp_password';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
// Recipients
$mail->setFrom('[email protected]', 'Your Name');
$mail->addAddress('[email protected]');
// IMPORTANT: The setFrom() email MUST match your verified address!
// Content
$mail->isHTML(true);
$mail->Subject = 'Test Email';
$mail->Body = 'This is a test email.';
$mail->send();
?>
<?php
// Configure SMTP in php.ini or use ini_set
ini_set('SMTP', 'smtp.smarthost.mx');
ini_set('smtp_port', '587');
ini_set('sendmail_from', '[email protected]');
// For authentication, you'll need additional configuration
// PHPMailer is recommended for authentication support
$to = '[email protected]';
$subject = 'Test Email';
$message = 'This is a test email.';
$headers = 'From: [email protected]' . "\r\n" .
'Content-Type: text/html; charset=UTF-8' . "\r\n";
// IMPORTANT: The From header MUST match your verified address!
mail($to, $subject, $message, $headers);
?>
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# SMTP configuration
smtp_server = "smtp.smarthost.mx"
smtp_port = 587
smtp_username = "[email protected]"
smtp_password = "your_smtp_password"
# Create message
msg = MIMEMultipart()
msg['From'] = '[email protected]' # MUST match your verified address!
msg['To'] = '[email protected]'
msg['Subject'] = 'Test Email'
# Add body to email
body = "This is a test email."
msg.attach(MIMEText(body, 'plain'))
# Connect to server and send email
try:
server = smtplib.SMTP(smtp_server, smtp_port)
server.starttls() # Enable encryption
server.login(smtp_username, smtp_password)
text = msg.as_string()
server.sendmail('[email protected]', '[email protected]', text)
server.quit()
print("Email sent successfully!")
except Exception as e:
print(f"Error: {e}")
const nodemailer = require('nodemailer');
// Create transporter
const transporter = nodemailer.createTransporter({
host: 'smtp.smarthost.mx',
port: 587,
secure: false, // Use STARTTLS
auth: {
user: '[email protected]',
pass: 'your_smtp_password'
}
});
// Email options
const mailOptions = {
from: '[email protected]', // MUST match your verified address!
to: '[email protected]',
subject: 'Test Email',
text: 'This is a test email.',
html: 'This is a test email.
'
};
// Send email
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.log('Error:', error);
} else {
console.log('Email sent:', info.response);
}
});
"Authentication failed" or "Invalid sender address"