Nodemailer Timeout



  • Hi I am receiving the following error when running my report.

    ReferenceError: done is not defined at evaluate-user-script.js:118:21 at Object.base.apply (/var/www/html/jsreportapp/node_modules/vm2/lib/contextify.js:166:34) at transporter.send.args (/var/www/html/jsreportapp/node_modules/nodemailer/lib/mailer/index.js:226:21) at Immediate. (/var/www/html/jsreportapp/node_modules/nodemailer-ses-transport/lib/ses-transport.js:112:31) at processImmediate (internal/timers.js:443:21) at process.topLevelDomainCallback (domain.js:136:23)
    

    I'm not quite sure what it means, but I have a feeling it may be a timeout error. I am running a report which called my API and gets a bunch of data, it loops over the data and within that data is all the emails the report needs to be sent to. There are about 100 emails.

    When I comment out the code that sends the email, everything works perfectly there are no errors shown.

    I am hoping this error message may mean more to someone, I'm probably being really stupid.

    Here is my send email function

    async function sendEmail(fileName, transporter, emails, result) {
        emails.forEach(function(email) {
            var mail = {
                from: "",
                to: email,
                subject: "Subject...",
                text: "See the attached report",
                html: `
                    <p>A bunch of email content....</p>
                `,
                attachments: [
                {  
                    filename: fileName,
                    content: result.content
                }],
            }
    
            transporter.sendMail(mail, function(error, response){
                transporter.close();
                if(error){
                    return done(error);
                }
            });
        });
    }
    

    Thanks
    Luke



  • Look at this line... where is the done defined?

    return done(error);
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.