Sending Email returns "Error: self signed certificate"

I would like to use https://www.npmjs.com/package/maildev for testing outgoing emails. When setting MAIL_URL=smtp://:@localhost:1025and sending an email I got “Error: self signed certificate”. Is there a way to skip the certificate verification for testing purposes?

For anyone else stumbling on this post having this issue, the following worked for me:

if (Meteor.isDevelopment){
   process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
}
2 Likes

Hey @ocolas
Thanks a lot! That worked for us.

I found this post here quite late, after many other, not helping stuff on stackoverflow etc.
So I’ll past a bit longer error log here, in hope to be found quicker in future.

      "reason": {
         "stack": "Error: self signed certificate\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1515:34)\n    at TLSSocket.emit (events.js:400:28)\n    at TLSSocket.emit (domain.js:475:12)\n    at TLSSocket._finishInit (_tls_wrap.js:937:8)\n    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:709:12)\n => awaited here:\n    at Function.Promise.await ([...]meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)\n    at Object.Email.send (packages/email/email.js:250:18)\n    at imports/notification/notification.ts:185:15\n    at Array.forEach (<anonymous>)\n    at Object.send [as added] (imports/notification/notification.ts:132:25)\n    at _CachingChangeObserver.added (packages/minimongo/local_collection.js:1315:28)\n    at added (packages/minimongo/local_collection.js:717:29)\n    at runWithEnvironment (packages/meteor.js:1486:24)\n    at packages/meteor.js:1499:14\n    at packages/mongo/observe_multiplex.js:178:30\n    at Array.forEach (<anonymous>)\n    at Function._.each._.forEach (packages/underscore.js:139:11)\n    at Object.task (packages/mongo/observe_multiplex.js:172:9)\n    at Meteor._SynchronousQueue.SQp._run (packages/meteor.js:1026:16)\n    at packages/meteor.js:1003:12",
         "message": "self signed certificate",
         "code": "ESOCKET",
         "command": "CONN",
         "futureStack": "Error: self signed certificate\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1515:34)\n    at TLSSocket.emit (events.js:400:28)\n    at TLSSocket.emit (domain.js:475:12)\n    at TLSSocket._finishInit (_tls_wrap.js:937:8)\n    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:709:12)"
      },