Error: Mail command failed: 530 5.7.57 Client not authenticated to send mail

29 views Asked by At

I'm using microsoft office 365 email purchased from godaddy. I have enabled smtp authentication in godaddy for the email. I'm using that email in nodejs app with nodemailer to send email. Getting this error. Error: Mail command failed: 530 5.7.57 Client not authenticated to send mail. I have attached the document of godaddy where smtp authentication is enabled and nodejs code.

enter image description here

import nodemailer from "nodemailer";

const transporter = nodemailer.createTransport({
  service: "Outlook365",
  pool: true,
  host: "smtp.office365.com",
  port: 587,
  secure: false,
  requireTLS: true,
  auth: {
    user: process.env.MAIL_USERNAME,
    pass: process.env.MAIL_PASSWORD,
  },
  tls: {
    ciphers: "SSLv3",
  },
});

export const sendEmail = async function (options = {}) {
  const { to, cc, subject, body } = options;
  const info = await transporter.sendMail({
    from: "[email protected]",
    to: options.to,
    subject: options.subject,
    html: "<b>Hello World</b>",
  });
};

0

There are 0 answers