Troubleshooting Common Issues

1. Connection Refused / Timeouts

Verify that port 587 (STARTTLS) or port 465 (Implicit TLS) is open on your host firewall. Check that `process.env.SMTP_HOST` points to a valid hostname.

2. Authentication Failure (MailAuthError)

MailPort requires TLS encryption before sending credentials. Ensure `tls: 'starttls'` or `tls: 'implicit'` is set. Verify application password or SMTP credential permissions.

3. TLS Verification Error (MailTlsError)

MailPort strictly verifies TLS certificates. If using self-signed certificates in local dev/testing environments, pass custom CA certificates via `ca: readFileSync('./ca.pem')`.

4. ESM Import Errors

MailPort is published strictly as ESM modules for Node.js 22+. Ensure your `package.json` specifies `"type": "module"`.