Skip to content

iGLOO-be/nodemailer-mail-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nodemailer Mail tracking

Install

npm install nodemailer-mail-tracking
yarn add nodemailer-mail-tracking

Usage

import { sendMail, expressApp } from "nodemailer-mail-tracking"
import { createTransport } from 'nodemailer';
import express from 'express';

const transporter = createTransport(/* ... */);
sendMail(mailTrackingOptions, transporter, sendMailOptions)


const app = express();
app.use('/mail-track', expressApp(mailTrackingOptions));

Options

const mailTrackOptions = {
  baseUrl: 'http://localhost:3000/mail-track',
  jwtSecret: 'secret',
  getData: data => {
    /* 
      Default data: { recipient: "[email protected]" }
      Add any data if you want
    */
    return { ...data, hello: 'world' };
  },
  onBlankImageView: data => {
    /* 
      When email is opened 
      data is default data + your data
    */
  },
  onLinkClick: data => {
    /* 
      When click on link in mail 
      data is default data + { link } + your data
    */
  },
}