controller/token_controller.js
function (user, req, cb) {
  CoreController.getPluginViewDefaultTemplate({
    viewname: 'email/user/forgot_password_link',
    themefileext: appSettings.templatefileextension,
  },
		function (err, templatepath) {
  if (err) {
    cb(err);
  }			else {
				// console.log('emailForgotPasswordLink templatepath', templatepath);
    if (templatepath === 'email/user/forgot_password_link') {
      templatepath = path.resolve(process.cwd(), 'node_modules/periodicjs.ext.login/views', templatepath + '.' + appSettings.templatefileextension);
    }
				// console.log('user for forgot password', user);
    var coreMailerOptions = {
      appenvironment: appenvironment,
      to: user.email,
      from: appSettings.fromemail || appSettings.adminnotificationemail,
      replyTo: appSettings.fromemail || appSettings.adminnotificationemail,
      subject: loginExtSettings.settings.forgotPasswordEmailSubject || appSettings.name + ' - Reset your password',
      emailtemplatefilepath: templatepath,
      emailtemplatedata: {
        user: user,
        appname: appSettings.name,
        hostname: req.headers.host,
        filename: templatepath,
        adminPostRoute: req.adminPostRoute,
      },
    };
    if (loginExtSettings.settings.adminbccemail || appSettings.adminbccemail) {
      coreMailerOptions.bcc = loginExtSettings.settings.adminbccemail || appSettings.adminbccemail;
    }
    CoreMailer.sendEmail(coreMailerOptions, cb);
  }
}
	);
	// cb(null, options);
}
function (user, req, cb) {
  CoreController.getPluginViewDefaultTemplate({
    viewname: 'email/user/forgot_password_link',
    themefileext: appSettings.templatefileextension,
  },
		function (err, templatepath) {
  if (err) {
    cb(err);
  }			else {
				// console.log('emailForgotPasswordLink templatepath', templatepath);
    if (templatepath === 'email/user/forgot_password_link') {
      templatepath = path.resolve(process.cwd(), 'node_modules/periodicjs.ext.login/views', templatepath + '.' + appSettings.templatefileextension);
    }
				// console.log('user for forgot password', user);
    var coreMailerOptions = {
      appenvironment: appenvironment,
      to: user.email,
      from: appSettings.fromemail || appSettings.adminnotificationemail,
      replyTo: appSettings.fromemail || appSettings.adminnotificationemail,
      subject: loginExtSettings.settings.forgotPasswordEmailSubject || appSettings.name + ' - Reset your password',
      emailtemplatefilepath: templatepath,
      emailtemplatedata: {
        user: user,
        appname: appSettings.name,
        hostname: req.headers.host,
        filename: templatepath,
        adminPostRoute: req.adminPostRoute,
      },
    };
    if (loginExtSettings.settings.adminbccemail || appSettings.adminbccemail) {
      coreMailerOptions.bcc = loginExtSettings.settings.adminbccemail || appSettings.adminbccemail;
    }
    CoreMailer.sendEmail(coreMailerOptions, cb);
  }
}
	);
	// cb(null, options);
}
function ( user , req , cb ) { CoreController . getPluginViewDefaultTemplate ( { viewname : 'email/user/forgot_password_link' , themefileext : appSettings . templatefileextension , } , function ( err , templatepath ) { if ( err ) { cb ( err ) ; } else { // console.log('emailForgotPasswordLink templatepath', templatepath); if ( templatepath === 'email/user/forgot_password_link' ) { templatepath = path . resolve ( process . cwd ( ) , 'node_modules/periodicjs.ext.login/views' , templatepath + '.' + appSettings . templatefileextension ) ; } // console.log('user for forgot password', user); var coreMailerOptions = { appenvironment : appenvironment , to : user . email , from : appSettings . fromemail || appSettings . adminnotificationemail , replyTo : appSettings . fromemail || appSettings . adminnotificationemail , subject : loginExtSettings . settings . forgotPasswordEmailSubject || appSettings . name + ' - Reset your password' , emailtemplatefilepath : templatepath , emailtemplatedata : { user : user , appname : appSettings . name , hostname : req . headers . host , filename : templatepath , adminPostRoute : req . adminPostRoute , } , } ; if ( loginExtSettings . settings . adminbccemail || appSettings . adminbccemail ) { coreMailerOptions . bcc = loginExtSettings . settings . adminbccemail || appSettings . adminbccemail ; } CoreMailer . sendEmail ( coreMailerOptions , cb ) ; } } ) ; // cb(null, options); }
create a func for the mail options
create a func for the mail options