Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- const nodemailer = require("nodemailer");
- // create reusable transporter object using the default SMTP transport
- let transporter = nodemailer.createTransport({
- host: "smtp.exmail.qq.com",
- port: 465,
- secure: true, // true for 465, false for other ports
- auth: {
- user: "xx@qq.com", // generated ethereal user
- pass: "xxxxxxxx" // generated ethereal password
- }
- });
- // setup email data with unicode symbols
- let mailOptions = {
- from: '"YourName" <xx@qq.com>', // sender address
- to: "xx@qq.com", // list of receivers
- subject: "... ✔", // Subject line
- text: "Hello world?", // plain text body
- html: "<b>Hello world?</b>" // html body
- };
- // send mail with defined transport object
- transporter.sendMail(mailOptions, (error, info) => {
- if (error) {
- return console.log(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));
- });
Add Comment
Please, Sign In to add comment