'contact form using `nodemailer` with `godaddy` not working, though getting success message

Here is my app.js which taking care of nodemailer part of my nodejs app. when I submitting form in react page, i am getting success message. But no mails are recived with outlook agent.

const express = require('express');
const cors = require('cors');
const nodemailer = require('nodemailer');


const app = express();
app.use(express.static(__dirname + '/public'));
app.use(express.urlencoded({ extended: true }))
app.use(express.json());
app.use(cors());

app.post("/send_mail", function (req, res) {

    const { email,option,username, phone, message } = req.body.text;
    const transporter = nodemailer.createTransport({
        service:"goDaddy",
        host: "smtp.office365.com",
        port: "587",
        secure: false,
        requireTLS: true,
        auth: {
           user: "[email protected]",
           pass: "xxxxx" 
       },
       tls: {
           ciphers:'SSLv3',
           rejectUnauthorized: false 
       }
    });

    let sendMessage = {
        from: `${email}`,
        to: "[email protected]",
        subject: "Enquiry from Deane Project Management",
        html: `
        <hr />
            <h1>Request for: ${option || "No title"}</h1>
            <span>Name: ${username}</span><br/>
            <span>Email: ${email}</span><br/>
            <span>Phone: ${phone || "No phone"}</span><br/>
            <span>Message:</span><br/>
            <p>${message || "No message"}</p>
        <hr />
        `
    }

    transporter.sendMail(sendMessage, function (err, info) {
        if (err) {
            console.log(err);
        } else {
            console.log('sent', info);
        }
    });

    res.sendStatus(200);
});

app.all('/*', function (req, res) {
    res.sendFile(__dirname + '/public/index.html');
});


app.listen(process.env.PORT || 4000, () => {
    console.log("port listning on port number 4000", process.env.PORT);
})

when i console console.log('sent', info); getting the following:

sent {
  accepted: [ '[email protected]' ],
  rejected: [],
  envelopeTime: 772,
  messageTime: 559,
  messageSize: 629,
  response: '250 ruuNnFPPrdyFu mail accepted for delivery',
  envelope: {
    from: '[email protected]',
    to: [ '[email protected]' ]
  },
  messageId: '<[email protected]>'
}

Not able to understand the issue here. anyone please help me? I am using godaddy service.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source