1

Hi i am using nodemailer to send email using cpanel i am getting error { "code": "EHOSTUNREACH", "errno": "EHOSTUNREACH", "syscall": "connect" }

Following is the code to send email

    var transporter = nodemailer.createTransport({
    host: 'hostname',
    port: 25,
    auth: {
        user: '----domain.com',
        pass: '********'
    }

    var mailOptions = {
        from: '-----@domain.com', 
        to: '-------@gmail.com', 
        subject: 'Order Recipt',
        text: 'html' 
    };

    // send mail with defined transport object
    transporter.sendMail(mailOptions, function(error, info){
        if(error){
            console.log("Error type:", error.name);
            console.log("SMTP log:", error);
        }
        else {
            console.log('Message sent: ' + info.response);
        }
    });

can any body help!!

Nauman Bashir
  • 189
  • 1
  • 4
  • 10

0 Answers0