0

I am trying to have my meteor application send an e-mail using my own e-mail server.

I installed my e-mail's server certs onto my meteor app server by doing:

  • openssl s_client -connect my-email-server.com:443 <<<'' | openssl x509 -out /tmp/mycert
  • cp /tmp/mycert /usr/local/share/ca-certificates/
  • update-ca-certificates

Which appeared to install correctly (I also used dpkg-reconfigure ca-certificates to install the certs) (ref: 90607)

I then start my meteor app in the following ways, none of which work to successfully send my e-mail:

  • MAIL_URL=smtp://user:password@my-email-server.com:587 meteor
  • CAFILE="/tmp/mycert" MAIL_URL=smtp://user:password@my-email-server.com:587 meteor

The code I am calling in my application is:

Email.send({
            to: emailAddress,
            from: "user@my-email-server.com",
            subject: "Example Email",
            text: "The contents of our email in plain text.",
        });

The error I am getting is:

I20180114-04:09:25.698(-5)? Exception while invoking method 'emailMethod' Error: unable to verify the first certificate
I20180114-04:09:25.698(-5)?     at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
I20180114-04:09:25.698(-5)?     at emitNone (events.js:106:13)
I20180114-04:09:25.699(-5)?     at TLSSocket.emit (events.js:208:7)
I20180114-04:09:25.699(-5)?     at TLSSocket._finishInit (_tls_wrap.js:637:8)
I20180114-04:09:25.699(-5)?     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38)

Exception while invoking method 'emailMethodHere' Error: unable to verify the first certificate

When I run the meteor app via NODE_TLS_REJECT_UNAUTHORIZED=0 MAIL_URL=smtp://user:password@my-email-server.com:587 meteor then it works as expected (bypassing the cert entirely), so I know the trust/certificate is the issue. Where is my error? How do I tell meteor to trust the certificate that I have obtained via the openssl command above?

My related research before resorting to posting:

zz3star90
  • 165
  • 1
  • 11
  • 1
    There is a thing called letsencrypt which can provide you with SSL certs at no charge, and the root CA is now in browsers, which means it works perfectly. No need for the shenanigans with self signed certs any more – Mikkel Jan 14 '18 at 13:13
  • @Mikkel Well that's a way to solve my problem and avoid needing an answer to this question. Nice! – zz3star90 Jan 26 '18 at 21:07
  • 1
    Maybe I should post it as an answer and you can mark it as correct? – Mikkel Jan 26 '18 at 21:18

0 Answers0