Decryption of SSL certificate for nodemailer

I'm having React+Nodejs app on my server running globally via pm2.
How can I decrypt ssl certificate so Nodemailer will work? It's not working right now.
My domain is
Here's my server.js/mailer.js code

  1. mailer.js

const sendEmail = async (subject, send_to, send_from, message) => {
  const transporter = nodemailer.createTransport({
    service: 'gmail',
    auth: {
      user: 'mymail',
      pass: 'pass',
    tls: {
      rejectUnauthorized: false,
  const options = {
    from: send_from,
    to: send_to,
    subject: subject,
    html: message,

  // send email
  transporter.sendMail(options, function (error, info) {
    if (error) {
    } else {

module.exports = sendEmail;
  1. server.js
const dotenv = require('dotenv').config();
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const sendEmail = require('./sendemail');

const app = express();

// Middleware


// Route

app.get('/', (req, res) => {
});'/sendmail', async (req, res) => {
  const { email } = req.body;

  try {
    const send_to = `Новая заявка с сайта! Номер телефона: ${}`;
    const send_from = 'mail'; //
    const subject = email;
    const message = `content`
    await sendEmail(send_to, send_from, subject, message);
    res.status(200).json({ success: true, message: 'Email Sent' });
  } catch (error) {

const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
  console.log(`Server is running at ${PORT}...`);

What should I add to my code in order to decrypt content coming from frontend?
I added a certbot via sudo apt install certbot python3-certbot-nginx
Btw running site on beget vps server

Certificates aren't ordinarily encrypted, so they wouldn't need to be decrypted.

In what way is it "not working," and what makes you believe that its non-"working" (whatever that means) status has anything to do with any certificate?


Maybe I said something wrong. I'm sorry.
I also have nodejs application running on port5000 but without https.
it's like
So in my html it's'', data)
I'm sending data from https to http. Maybe it's not possible?
I was asking if i should use privkey.pem file that certbot created.

I have no idea what you mean by this statement or question. Are you trying to make this nodejs application (whatever it is) accessible via HTTPS, rather than (or in addition to) HTTP? And if that's the case, what do its docs say about how to do that?


Do you have, by any chance, nginx running as a reverse proxy? I.e., the connection goes as follows:

internet -> nginx:443 (https) -> Express:5000 (http)


Because if nginx is configured to do all the TLS stuff, why bother with getting Express to work with TLS? In that case everything is already decrypted (and encrypted when sending back to the internet) by nginx.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.