How to use the email-templates function in email-templates

To help you get started, we’ve selected a few email-templates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benjsicam / node-graphql-microservices / grpc-services / mailer / src / services / mailer.service.js View on Github external
async send({ req, response }) {
    let data = Buffer.from(req.data)
    data = JSON.parse(data.toString())
    
    const email = new Email({
      message: {
        from: 'akzdinglasan@gmail.com' // change to support email later
      },
      send: true,
      transport: this._transporter
    })

    this._logger.info(`${this._serviceName}#send.call`, req)

    try {
      const result = await email.send({
        template: path.join(__dirname, '../', 'templates', req.template),
        message: {
          to: req.to
        },
        locals: {
github kartikayg / StatusPage / notification-service / src / lib / email.js View on Github external
const send = async (templateName, subscription, vars, from, transporter) => {

  // email template object. use passed variables or from env conf
  const emailTpl = new EmailTemplate({
    message: {
      from: from || conf.email.SYSTEM_EMAIL_FROM_ADDRESS
    },
    send: true,
    transport: transporter || getDefaultTransporter(),
    views: {
      root: path.resolve('src/email_templates'),
      options: {
        extension: 'ejs'
      }
    }
  });

  // prepare template vars
  const templateVars = Object.assign(_cloneDeep(vars || {}), {
    template: templateName,
github danielwii / asuna-node-server / src / modules / email / email.service.ts View on Github external
secure: configLoader.loadBoolConfig('MAIL_SSL'), // upgrade later with STARTTLS
        auth: {
          user: configLoader.loadConfig('MAIL_USERNAME'),
          pass: configLoader.loadConfig('MAIL_PASSWORD'),
        },
      };
      this.transporter = mailer.createTransport(transport);
    } else {
      logger.warn(oneLine`
        MAIL_HOST && MAIL_PORT && MAIL_USERNAME && MAIL_PASSWORD
        must be set up to send mail in real world
      `);
      this.transporter = mailer.createTransport({ jsonTransport: true });
    }

    this.emailTemplate = new EmailTemplate({
      message: {
        from: configLoader.loadConfig('MAIL_FROM') || configLoader.loadConfig('MAIL_USERNAME'),
      },
      preview: false,
      send: true, // will send emails in development/test env
      subjectPrefix: env === 'production' ? false : `[${env.toUpperCase()}] `,
      transport: this.transporter,
    });
  }
github stefanvanherwijnen / quasar-auth-starter / backend / src / common / email / index.ts View on Github external
import i18n from 'i18n'
import Email from 'email-templates'

const Mailer = new Email({
  message: {
    from: process.env.MAIL_FROM
  },
  send: true,
  transport: {
    host: process.env.MAIL_HOST,
    port: Number(process.env.MAIL_PORT),
    auth: {
      user: process.env.MAIL_USERNAME,
      pass: process.env.MAIL_PASSWORD,
    },
    i18n: i18n.__,
  }
})

export default Mailer

email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for Forward Email and Lad.

MIT
Latest version published 11 months ago

Package Health Score

75 / 100
Full package analysis

Popular email-templates functions