No Emails when deployed in docker

Description

For testing RC as our future Chat System i installed the Version 7.7.1 - starter
on my local machine with deployment method “docker”.

Server Setup Information

  • Version of Rocket.Chat Server: 7.7.1 - starter
  • Operating System: Ubuntu
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version:
  • MongoDB Version:

Any additional Information

After setting up the SMTP values in the Admin Page. (see screenshot)
I cannot get any email message, neither from admin page nor from any other event.

I tested the SMTP connection from inside the docker network by setting up a node-service and ran this js code, this works fine:

const nodemailer = require("nodemailer");

// Create a test account or replace with real credentials.
const transporter = nodemailer.createTransport({
    host: "smtp.ionos.de",
    port: 587,
    secure: false, // true for 465, false for other ports
    auth: {
        user: "chatservice@schade-consulting.de",
        pass: "xxxxx",
    },
});

// Wrap in an async IIFE so we can use await.
(async () => {
    const info = await transporter.sendMail({
        from: "chatservice@schade-consulting.de",
        to: "schade.klaus@t-online.de",
        subject: "Hello Klaus",
        text: "Hello world and Klaus", // plain‑text body
        html: "<b>Hello world an Klaus</b>", // HTML body
    });

    console.log("Message sent:", info.messageId);
})();

Thanks for any advice
Klaus

What do your docker logs say?

You can enable debug logs as well.

Have you tried smtps as you are using 587?

Thank you very much for your quick response.

This is logged error with smtp:

Error: Mail command failed: 530 Authentication required
    at SMTPConnection._formatError (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)
    at SMTPConnection._actionMAIL (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:1594:34)
    at SMTPConnection.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:1063:18)
    at SMTPConnection._processResponse (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:969:20)
    at SMTPConnection._onData (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:755:14)
    at Socket.SMTPConnection._onSocketData (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:193:44)
    at Socket.emit (node:events:518:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Socket.Readable.push (node:internal/streams/readable:392:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'EENVELOPE',
  response: '530 Authentication required',
  responseCode: 530,
  command: 'MAIL FROM'
}

And this is the logged error with smtps

[Error: 48428357617F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
] {
  library: 'SSL routines',
  reason: 'wrong version number',
  code: 'ESOCKET',
  command: 'CONN'
}

The credentials are OK, as I checked it with the nodemailer request.

The node service is not the same as the Rocket service. So it isn’t a complete comparison.

That is your error. For whatever good reason.

As a matter of interest have you tested smtps/465 ?

I will ask if someone will take a look.

Hallo reetp,

this is a private message to topic https://forums.rocket.chat/t/no-emails-when-deployed-in-docker/22283/5

because it seems to be a bug which you should know at first.

After your answer I tried to change the port … but I cannot open the settings page any more (see image below).

No this isn’t a private message… (And please don’t DM - I don’t answer).

What do your logs say??

Thank you for your help.

  1. There were no logs according to the missing admin-settings page, but after a server restart it was visible.
  2. After solving the issue 1) i could change the protokoll to “smtps” and port “465”. Then I got the emails, fine.
    My email provider seems to accept smtp and smtps and for ever good reason from within RC only smtps seems to work.

I suspect your provider doesn’t actually handle smtp for sending. Only smtps.

You’d need to check that.

Probably here.

Nothing there about unencrypted smtp.

Smtps/465 seems preferred. 587 still requires encrypted StartTls.

Your test script connection probably got upgraded without you realising, hence it isn’t a great test.

At least it is fixed!!