nodemailer gives type error: this.transporter.send is not a function

const nodemailer = require('nodemailer');
const smtpTransport = require('nodemailer-smtp-transport');
const xoauth2 = require('xoauth2');
const mailTransport = nodemailer.createTransport(smtpTransport,{
    service: 'Gmail',
            xoauth2: xoauth2.createXOAuth2Generator({

I want it to send the mail once the form has been successfully submitted
hence my code;

            from:'"createTops" ',
            subject:'successful completion of form',
            text:'thank you for signing up enjoy'
        }, function(err){
                console.error('unable to send email: '+error);

i get this error

TypeError: this.transporter.send is not a function
at _processPlugins.err (C:desktopexpressnode_modulesnodemailerlibmailerindex.js:214:34)....

Leave a Reply

Your email address will not be published. Required fields are marked *