SyntaxError: missing) after argument list

0

transporter.sendMail(mailOptions, (error, info) {
    if (error) {
        return console.log(error);
    }
    console.log('Message %s sent: %s', info.messageId, info.response);
});

Because that error comes out if the parenthesis is closing here })

    
asked by Santiago D'Antuoni 31.01.2017 в 19:21
source

2 answers

2

Because the callback has bad syntax.

Using function :

transporter.sendMail(mailOptions, function (error, info) { .. });

Using arrow function (ES6) :

transporter.sendMail(mailOptions, (error, info) => { ... });
    
answered by 31.01.2017 / 19:39
source
1

The function is still missing:

transporter.sendMail(mailOptions, function(error, info) { //Aquí!
    if (error) {
        return console.log(error);
    }
    console.log('Message %s sent: %s', info.messageId, info.response);
});
    
answered by 31.01.2017 в 19:39