analog-nico / pxl-for-emails Goto Github PK
View Code? Open in Web Editor NEWOpen and click tracking for html emails – hosted by any Express-based node.js app
License: ISC License
Open and click tracking for html emails – hosted by any Express-based node.js app
License: ISC License
var nodemailer = require('nodemailer');
var csv = require('csv');
var fs = require('fs');
let Pxl = require('pxl-mongodb');
let express = require('express');
let PxlMongodb = require('pxl-mongodb')
let msg = '<img src = "https://drive.google.com/file/d/1cToTGU25lbKG2yX9Bmhew6tM9vZYLOxP/view?usp=sharing" /> Hey man'
let pxl = new Pxl();
pxl.connect('mongodb://......', {})
let app = express()
app.use(pxl.trackPxl)
app.get('/shortly/:linkId', pxl.redirect)
let PxlForEmails = require('pxl-for-emails')
let pxlForEmails = new PxlForEmails({
pxl,
getFullShortenedLink(linkId) {
return `https://localhost:3000/shortly/${ linkId }`
}
})
let newmsg = pxlForEmails.addTracking(msg, {recipient: "[email protected]"})
var mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Do you need a professional Website for your business?',
html: newmsg
};
var transporter = nodemailer.createTransport({
service: 'gmail',
auth:{
user: '[email protected]',
pass: 'xxxx'
}
});
transporter.sendMail(mailOptions,function(error,info){
if(error){
console.log(error);
}
else{
console.log('Email sent : ' + info.response);
}
});
{ TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be one of type string or Buffer. Received type object
at validChunk (_stream_writable.js:258:10)
at PassThrough.Writable.write (_stream_writable.js:292:21)
at PassThrough.Writable.end (_stream_writable.js:579:10)
at Immediate.setImmediate [as _onImmediate] (D:\Marketing\Mailer\node_modules\nodemailer\lib\mime-node\index.js:978:46)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5) code: 'ESTREAM', command: 'API' }
It gets connected to the database but not updating the database. I think I'm having trouble with 'addTracking' method. Any kind of help will be appreciated. Thank you.
hey nice work but can you provide us with full example with node nodemailer??
thanks for awesome work
i was tryiung as per the documentation, no doc is creating in pxl
collection.
but link is creating
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.