Samuel Jung Hwan Park
Samuel Jung Hwan Park

Reputation: 99

Node Mailer does not work even though it says its successful

I have question about the nodemailer that I am working on. The result returns email sent, but I do not get any email. I am sure I am doing something wrong and I have no idea what that is. I will post my code below.

     let transporter = nodemailer.createTransport({
        //pool: true,
        host: "*****.net",
        port: ****,
        secure: false, 
        auth: {
          user: "****.com", 
          pass: "*****", 
        },
        tls: {
          // do not fail on invalid certs
          rejectUnauthorized: false,
        },
      });

var mailOptions = {
          from: '"xxx"<info@****.com>;', // sender address
          to: result.recordset[0].toEmail, // list of receivers
          subject: "NEW USER", // Subject line
          html: result.recordset[0].content, // plain text body
        };

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

        transporter.verify(function (error, success) {
          if (error) {
            console.log(error);
          } else {
            console.log("Server is ready to take our messages");
          }
        });

AND THIS IS THE MESSAGE I GET FROM THE TERMINAL BELOW

Server is ready to take our messages

Email sent: 250 uPMSkJg8an7bs mail accepted for delivery

Upvotes: 1

Views: 237

Answers (1)

aligumustosun
aligumustosun

Reputation: 152

If you are using for example a cheap mail service, mails might be sent after some time. I had that problem before. Services use queue system and prioritize the mail requests based on the pricing. Other than that, you can check your spam folder just in case if that might be a problem.

Upvotes: 1

Related Questions