Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

how to send attachments to node mailer file not found

function sendEmail(userEmail, htmlString, requestSnap, FIREBASE_WEB) {

fileName = "test.pdf";
folderName = "./" + uuid.v4();
mkdirp(folderName, function (err) {
    if (err) console.error(err)
    else console.log(folderName + ' folder created!')
});

pdf.create(htmlString + userEmail, options).toFile(folderName + '/' + fileName, function (err, res) { // if the file doesnt exist it will be created
    if (err) return console.log(err);
    console.log(res);

    var transporter = nodemailer.createTransport(smtpTransport({
        service: 'Gmail',
        auth: {
            user: '...',
            pass: '...'
        }
    }));
    console.log("
PATH " + folderName + "/" + fileName);

    var mailOptions = {
        from: 'marija.lukaroska.cw@gmail.com',
        to: userEmail,
        subject: 'So mail vo pdf-ot',
        text: 'Hellow',
        attachments: [{
            path: folderName + "/" + fileName
        }]
    };

    transporter.sendMail(mailOptions, function (error, info) {
        if (error) {
            console.log("ERROR kkkk " + error);
        } else {
            console.log('Email sent: ' + info.response);
            console.log("REQUEST SNAP " + JSON.stringify(requestSnap));
        }

        deleteFolderRecursive(folderName);
    });
});
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: how to count digits in python 
Typescript :: filename requests python 
Typescript :: How to combine pdf documents C# 
Typescript :: type script array 
Typescript :: components of cucumber bdd framework 
Typescript :: filter() array of objects on change react 
Typescript :: typescript class validator validate enum array 
Typescript :: ts code to move the next month 
Typescript :: how to read temp file in windowsnodejs 
Typescript :: create CSS class in directive angular 
Typescript :: run build dist in local angualr 
Typescript :: typescript dynamic dict 
Typescript :: View and navigate your assignments (teacher) code for asp.net 
Typescript :: typescrpt add onject to window namespace 
Typescript :: npm install ionic2-calendar 
Typescript :: typescript variable 
Typescript :: typescript run on save 
Typescript :: file reader with promise 
Typescript :: bits required for address 1 GB memory 
Typescript :: typescript syntax 
Typescript :: arrays in typescript 
Typescript :: cacerts default password 
Typescript :: nuxt3 nuxtServerInit 
Typescript :: paginator 
Typescript :: how to compra vales on lists python 
Typescript :: derivative dots overleaf 
Typescript :: can i use different flutter versions for differnt progjects ? 
Typescript :: how t make fireball roblox or lua 
Typescript :: combine results from two columns in ms sql 
Typescript :: nullable parameter typescript 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =