How to use the nodemailer.getTestMessageUrl function in nodemailer

To help you get started, we’ve selected a few nodemailer 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 voluntarily / vly2 / x / email / testemail.js View on Github external
})

  // send mail with defined transport object
  const info = await transporter.sendMail({
    from: '"Fred Foo 👻" ', // sender address
    to: 'bar@example.com, baz@example.com', // list of receivers
    subject: 'Hello ✔', // Subject line
    text: 'Hello world?', // plain text body
    html: '<b>Hello world?</b>' // html body
  })

  console.log('Message sent: %s', info.messageId)
  // Message sent: 

  // Preview only available when sending through an Ethereal account
  console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info))
  // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
}
github schizobulia / warehouse / node / email.js View on Github external
});

    // send mail with defined transport object
    let info = await transporter.sendMail({
        from: '"Fred Foo 👻" ', // sender address
        to: '2833324528@qq.com', // list of receivers
        subject: 'Hello ✔', // Subject line
        text: 'Hello world?', // plain text body
        html: '<b>Hello world?</b>' // html body
    });

    console.log('Message sent: %s', info.messageId);
    // Message sent: 

    // Preview only available when sending through an Ethereal account
    console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
    // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
}
github obiwankenoobi / react-express-boilerplate / server / src / services / activateAccountEmail.ts View on Github external
transporter.sendMail(mailOptions, (error, info) => {
        if (error) {
          console.log({ error });
          reject({
            error
          });
        }
        console.log("Message sent: %s", info.messageId);
        // Preview only available when sending through an Ethereal account
        console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
      });
      resolve({
github obiwankenoobi / react-express-boilerplate / server / src / services / resetPasswordEmail.ts View on Github external
transporter.sendMail(mailOptions, (error, info) => {
        if (error) {
          reject({
            message: "ERR",
            error
          });
        }
        console.log("Message sent: %s", info.messageId);
        // Preview only available when sending through an Ethereal account
        console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
      });
      resolve({
github kevenleone / graphscript / src / utils / sendEmail.ts View on Github external
const { ENVIRONMENT, MAIL_FROM } = defaults;
  const config = await MailerCredentials();
  const transporter = nodemailer.createTransport(config);

  const mailOptions = {
    from: MAIL_FROM,
    to, // list of receivers
    subject, // Subject line
    html: `${content}`, // html body
  };

  const info = await transporter.sendMail(mailOptions);
  if (ENVIRONMENT !== 'production') {
    logger.debug(`Message sent: ${info.messageId}`);
    // Preview only available when sending through an Ethereal account
    logger.debug(`Preview URL: ${nodemailer.getTestMessageUrl(info)}`);
  }
}
github Uconnect-Technologies / wertik-js / src / framework / mailer / index.ts View on Github external
const defaultSendEmailMethod = async function(template: string, variables: any, credentials: any) {
  let transporter: any = await mailerInstance();
  let compiled = handlebars.compile(template);
  let resultTemplate = compiled(variables);
  try {
    let send = await transporter.sendMail({
      from: credentials.from,
      to: credentials.to,
      html: resultTemplate,
      subject: credentials.subject
    });
    console.log("Message sent: %s", send.messageId);
    console.log("Preview URL: %s", nodemailer.getTestMessageUrl(send));
    return send;
  } catch (e) {
    console.log(`Failed sending email: ${e.message}`);
  }
};
github fischermatte / geolud / geolud-server-node / src / mail / mail.service.ts View on Github external
transporter.sendMail(mailOptions, (error, info) => {
      if (error) {
        Logger.error(`error sending email: ${error}`);
        return;
      }
      Logger.log(`Message sent: ${info.messageId}`);
      const testMessageUrl = nodemailer.getTestMessageUrl(info);
      Logger.log(`Preview URL: ${testMessageUrl}`);
    });
  }