Nodemailer Incorrect authentication data

I am writing a function for sending magic links to new users.

 public async sendMagicLink(email: string) {
        const transporter = mailer.createTransport({
          host: 'smtp.ukr.net',
          port: 465,
          secure: true,
          auth: {
            user: 'myemail',
            pass: 'my password',
          },
        });
        transporter.verify().then(console.log).catch(console.error);
      }

The following code fails with this error.

  Error: Invalid login: 535 Incorrect authentication data
     at SMTPConnection._formatError 

Credentials are 100% correct. Does anyone have any ideas about what might have gone wrong? I have tried all solutions possible both from stack overflow and github.

And if I set port:2525 and secure: false I get Error: Greeting never received and greetingTimeout doesn’t help.

Leave a Reply

Your email address will not be published. Required fields are marked *