Meteor服务器无需认证发送邮件问题及参数配置咨询
Absolutely, you can adjust SMTP settings in Meteor to disable authentication and bypass certificate checks—similar to PHP's SMTPAuth=false—by adding query parameters to your MAIL_URL. Here's how to resolve your specific issues:
Meteor's email package relies on Nodemailer under the hood, so the MAIL_URL supports query string parameters that map directly to Nodemailer's SMTP transport options.
1. Disable SMTP Authentication
To tell Meteor not to attempt authentication (matching PHP's SMTPAuth=false), add auth=false as a query parameter. You can also remove the @ from your original URL since you don't need to pass credentials:
2. Fix the "unable to verify the first certificate" Error
This error occurs because Node.js doesn't trust the SSL certificate from your relay server (it might be self-signed or issued by an internal CA). To bypass certificate verification, add tls.rejectUnauthorized=false to the query string. Important note: This disables SSL certificate checks, so only use this if you fully trust your relay server (e.g., it's an internal company server).
Combined Working MAIL_URL
Putting it all together, your MAIL_URL should look like this:
MAIL_URL=smtp://relay.xy.xxxxx.com:578?auth=false&tls.rejectUnauthorized=false
Testing the Setup
- Set this environment variable before starting your Meteor app (e.g.,
export MAIL_URL=...on Linux/macOS, orset MAIL_URL=...on Windows). - Alternatively, define it in your Meteor settings file under
private.mailUrland load it on server startup.
If your relay server uses STARTTLS (common on port 587), you don't need extra parameters—Nodemailer will handle it automatically unless you explicitly disable TLS with tls=false.
内容的提问来源于stack exchange,提问作者Jens Attermeyer

