If you searched for `nodemailer smtp`, this guide covers:

1. transport configuration with secure defaults
2. environment-based credential management
3. common Node SMTP failure patterns
4. inbox-assertion testing in CI

For npm package install, version, and `createTransport` details, start with the [Nodemailer NPM guide](/blog/nodemailer-npm/). Use this page when the question is specifically SMTP setup and production validation.

## Minimal Nodemailer SMTP setup

```bash
npm install nodemailer
```

```javascript
const nodemailer = require("nodemailer");

const transporter = nodemailer.createTransport({
  host: process.env.SMTP_HOST,
  port: Number(process.env.SMTP_PORT || 587),
  secure: false,
  auth: {
    user: process.env.SMTP_USERNAME,
    pass: process.env.SMTP_PASSWORD,
  },
});

async function sendWelcomeEmail(to) {
  await transporter.sendMail({
    from: process.env.SMTP_FROM_ADDRESS,
    to,
    subject: "Welcome",
    text: "Your account is ready.",
  });
}
```

## SMTP configuration defaults to standardize

For stable releases, document and enforce:

- host and port per environment
- TLS mode (`587` STARTTLS vs `465` implicit TLS)
- sender address policy and domain alignment
- timeout/retry behavior for transient failures

Related references:

- [SMTP authentication](/blog/smtp-authentication/)
- [STARTTLS vs SSL/TLS](/blog/starttls-ssl-tls/)
- [SMTP ports guide](/guides/what-are-smtp-ports/)

## Common Nodemailer SMTP failures

### `EAUTH` or SMTP `535` errors

Likely causes:

- wrong credentials
- auth mechanism mismatch
- sender-domain policy mismatch

### Connection and timeout failures

Likely causes:

- blocked outbound network path
- wrong port/TLS combination
- DNS/hostname issues

### Sent response but no inbox arrival

Likely causes:

- spam placement
- sender reputation/authentication posture
- mailbox filtering rules

## Add receive-side verification to Node test suites

SMTP send success is not enough. Also assert:

- message arrival
- expected subject/body
- link and OTP correctness
- timing/SLA behavior

Recommended testing routes:

- [Nodemailer NPM guide](/blog/nodemailer-npm/)
- [Email Sandbox](/product/email-sandbox/)
- [Email integration testing](/product/email-integration-testing/)
- [Email webhooks](/guides/email-webhooks/)
- [Email deliverability test](/testing/email-deliverability-test/)

## Nodemailer SMTP production checklist

1. Keep SMTP credentials and sender settings in environment variables.
2. Validate SPF, DKIM, and DMARC before releasing sender changes.
3. Add inbox assertions for critical user journeys.
4. Capture delivery and failure events for triage.
5. Re-test after template, DNS, or provider changes.

## FAQ

### Is Nodemailer enough for production SMTP?

Yes, if paired with configuration discipline, inbox testing, and deliverability monitoring.

### Should Nodemailer use port 587?

Usually yes with STARTTLS, but always use provider-specific settings and validate in each environment.

### Can Nodemailer be used for receive-side inbox checks?

Nodemailer is for sending. Use inbox APIs and test infrastructure for receive-side assertions.

## Next steps

- [Nodemailer NPM tutorial](/blog/nodemailer-npm/)
- [Node SMTP language guide](/guides/smtp/node-send-email-smtp/)
- [SMTP and IMAP guide](/guides/smtp-imap/)
