npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

connector-email-plugdo

v1.1.0

Published

envio de email con node js usando plugdo

Readme

Conector de Plugdo node.js version 1.1.0 en face beta

hicimos uso de paquetes externos como nodemailer y nodemailer-express-handlebars para leer mar sobre este paquete revisar su web https://www.npmjs.com/package/express-handlebars y tambien verse https://www.npmjs.com/package/nodemailer

npm i conector-email-plugdo --save 

Para registrar nuestro modulo una vez descargada y configurado plugdo-node https://www.npmjs.com/package/plugdo-node copiar lo siguiente:

process.env.pathstr = path.resolve(__dirname);
const myConnectorEmail = require("connector-email-plugdo/email");
plugdo.registerConnector("http", "email", myConnectorEmail.email());

una vez configurado nuestro espacio de trabajo usando plugdo-node, ir a la carpeta plugdo/collector.

plugdo/collector

configuraremos nuestro primer connector tipo http de envio de email

plugdo.collector("emailSend", {
  type: "http",
  action: "email",
  server: {
    host: "smtp.gmail.com",
    service: "gmail",
    secure: true,
    port: 25,
    auth: {
      user: "[email protected]",
      pass: "xxxxxxxxxxxxxxx",
    },
    tls: {
      rejectUnauthorized: false
    }
  },
  template: 'welcome',
  subject: "Test conector",
  templateOption: {
    viewEngine: {
      extname: '.hbs',
      layoutsDir: 'content/template/',
      defaultLayout : 'welcome',
      partialsDir : 'content/template/welcome' 
  },
  viewPath: process.env.pathstr + 'content/template/' ,
  extName: '.hbs'
}
});
### importante ruta del template 

process.env.pathstr es mi ruta global donde esta mi archivo definimos lo siguiente en nuestro archivo index.js de nuestra aplicación node

process.env.pathstr = path.resolve(__dirname);

para usar el envio de correo con gmail tiene que configurar su correo debe ir en la opcion de configuracion entrar a la opción Reenvío y correo POP/IMAP para activarlo

si el api por algun motivo debuelve un error 534 es que no has activado la opción para acceder al SMTP desde aplicaciones menos seguras. Actívalo y vuelve a intentar https://myaccount.google.com/lesssecureapps?pli=1

IMPORTANTE EN LA CONFIGURACIÓN DE LOS CREDEMCIALES DE TU EMAIL

 host: "smtp.gmail.com",
    service: "gmail",
    secure: true,

TAMBIEN SE PUEDE PROBAR LA SIGUIENTE CONFIGURACION

host: "smtp.gmail.com", // hostname
secureConnection: false,
port: 465,

SE COLOCA LA OPCIÓN DE SECURE EN FALSE SI ES UN CORREO PAGO DE GMAIL DE LO CONTRARIO SE DEJA E TRUE

una vez echo esto explicaremos las opciones del connector plugdo-node

sconfiguración del server
server: {
    host: "smtp.gmail.com",
    service: "gmail",
    secure: true,
    port: 25,
    auth: {
      user: "[email protected]",
      pass: "xxxxxxxxxxxxxxx",
    },
    tls: {
      rejectUnauthorized: false
    }
  }

esta opcion es la mas importante aqui es donde debera ingresar las credenciales del correo que estara enviando los email a distintos usuarios, la configuracion varia dependiendo el host que usa este conector solo esta probrado para correos de gmail

configuracion del template
template: 'welcome',
  subject: "Test conector",
  templateOption: {
    viewEngine: {
      extname: '.hbs',
      layoutsDir: 'content/template/',
      defaultLayout : 'welcome',
      partialsDir : 'content/template/welcome' 
  },
  viewPath: 'content/template/' ,
  extName: '.hbs'
}

aqui vamos a agregar el template que va a ser enviado a los usuarios los archivos se colocan en content dentro de una carpeta que usted llamara template ahi podra crear las carpetas contenedoras de los archivos .hbs

la extención devera ser .hbs de lo contrario no funcionara el template

configuracion del integrador o web api en plugdo-node


plugdo.integration("send-email", (message, send) => {
  let response = {};
  var emailData = {
    from: {
      email: "[email protected]"
    },
    context: {
     data:{
      name: "Abdiel",
      totalP: 400,
      cantidad: 9
     }
    }
  }
  plugdo.collect("emailSend").get(emailData, (data, err) => {
    if (err) {
      send({}, err);
    } else {
      response.result = data;
      send(response);
    }
  });
})

se creara un objeto con un nombre x dentro tendra las popiedades que son: from que es el correo a quien se le enviara el email y el context que se le pasara un objeto data con propiedades IMPORTANTE ESTA PARTE DE CONTEXT ES LA QUE EL TEMPLATE QUE DEFINIMOS ANTERIORMENTE CONSUMIRA AHI PODRA PONER DATOS QUE USTED DEASEE SIEMPRE Y CUANDO LLEVE EL SIGUIENTE ESQUEMA

var emailData = {
    from: {
      email: "[email protected]"
    },
    context: {
     data:{
      name: "Abdiel Flores ",
      totalP: 400,
      cantidad: 9
     }
    }
  }

dentro de context debe ir un objeto data que tendra las propiedades que usted desee.

IMPORTANTE

siempre dentro de context debe ir data con sus propiedades

data:{
      name: "Abdiel Flores ",
      totalP: 400,
      cantidad: 9
     }

Para saber mas sobre el integrador visitar la documentacion de plugdo-node https://docs.plugdo.com/#plugdo-node-server