Generate ready-to-run SMTP test code for any provider. Fill in your settings and copy the code.
// Install: npm install nodemailer
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
host: '',
port: 587,
secure: false, // true for 465, false for 587
auth: {
user: '',
pass: '',
},
});
async function sendTestEmail() {
try {
const info = await transporter.sendMail({
from: '',
to: '',
subject: 'SMTP Test Email',
text: `This is a test email sent to verify SMTP configuration.`,
});
console.log('Message sent:', info.messageId);
} catch (error) {
console.error('Error:', error);
}
}
sendTestEmail();| Port | Encryption | Usage |
|---|---|---|
25 | None (plaintext) | Server-to-server relay. Often blocked by ISPs. |
465 | Implicit SSL/TLS | Direct encrypted connection. Legacy but widely supported. |
587 | STARTTLS | Recommended submission port. Starts plain, upgrades to TLS. |
2525 | STARTTLS (alternate) | Alternative when 587 is blocked. |
| Provider | SMTP Host | Ports | Authentication |
|---|---|---|---|
| Gmail | smtp.gmail.com | 465, 587 | App Password (2FA required) |
| Outlook | smtp-mail.outlook.com | 587 | Account password or OAuth |
| Yahoo | smtp.mail.yahoo.com | 465 | App Password |
| SendGrid | smtp.sendgrid.net | 587, 465 | API Key as password |
| Amazon SES | email-smtp.<region>.amazonaws.com | 587, 465 | SMTP credentials |
| Mailgun | smtp.mailgun.org | 587, 465 | Domain credentials |
| Zoho | smtp.zoho.com | 465 | Account password |