SMTP settings for yandex mail not working

Hi there!

I’ve setup a yandex mail account to use instead of sendmail as provided with peertube docker installation (Docker guide | PeerTube documentation) but it’s not working.

Whenever an email needs to be sent (notifications, about form, etc.) by peertube, I get an error message like this:

peertube1.log:{"err":{"stack":"Error: Greeting never received\n    at SMTPConnection._formatError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)\n    at SMTPConnection._onError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:776:20)\n    at Timeout.<anonymous> (/app/node_modules/nodemailer/lib/smtp-connection/index.js:710:22)\n    at listOnTimeout (node:internal/timers:559:17)\n    at processTimers (node:internal/timers:502:7)","message":"Greeting never received","code":"ETIMEDOUT","command":"CONN"},"level":"error","message":"Error in email sender.","label":"soberanatv.mooo.com:443","timestamp":"2023-04-28T12:58:32.350Z"}

I’ve setup some test code to run nodemailer (the lib used by peertube) to try to reproduce the error:

var nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport({
    direct: true,
    host: 'smtp.yandex.com',
    port: 465,
    ignoreTLS: false,
    auth: {
        user: '[my user name]',
        pass: '[my app password, a yandex thing]'
    },
    secure: true
});

var mailOptions = {
    from: '[my from email]',
    to: '[to some email]',
    subject: 'Teste de envio de emails usando nodemailer com variações',
    text: 'Este email é um teste de envio de emails usando nodemailer rodando diretamente no paranauê lá.'
};

transporter.sendMail(mailOptions, function (error, info) {
    if (error) {
        return console.log(error);
    }
    console.log("Message sent " + info.response)
});

The error Greeting never received only happens when the option secure is set to false in my test code. Peertube maps the docker environment variable PEERTUBE_SMTP_TLS to this option I’ve mentioned, so I think this is not the problem.

I’m running my peertube instance behind a nginx proxy which is on another machine. I don’t know if this can be the source for this problem, just sharing in case it helps pointing out the cause of this issue.

As always happens with us developers, when help is asked, things start to work automagically. :slight_smile:

It seems that yandex has a very strict spam policy. After exchanging some emails using their webmail interface, now the contact form on peertube is correctly sending emails.

However, the error message Greeting never received should not be returned when yandex returns spam warnings - they return another message explaining the reason the message was not sent is due to spam detection.

I’ll keep posting updates about my issue for future reference to other people. But I still don’t consider my issue fully solved.

To summarize: the problem was effectively the yandex spam policy. By using their web interface and sending some emails in there, things started to work.

Not a PeerTube issue.