Guest User

Untitled

a guest
Mar 29th, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. "use strict";
  2. const nodemailer = require("nodemailer");
  3.  
  4. // create reusable transporter object using the default SMTP transport
  5. let transporter = nodemailer.createTransport({
  6. host: "smtp.exmail.qq.com",
  7. port: 465,
  8. secure: true, // true for 465, false for other ports
  9. auth: {
  10. user: "xx@qq.com", // generated ethereal user
  11. pass: "xxxxxxxx" // generated ethereal password
  12. }
  13. });
  14.  
  15. // setup email data with unicode symbols
  16. let mailOptions = {
  17. from: '"YourName" <xx@qq.com>', // sender address
  18. to: "xx@qq.com", // list of receivers
  19. subject: "... ✔", // Subject line
  20. text: "Hello world?", // plain text body
  21. html: "<b>Hello world?</b>" // html body
  22. };
  23.  
  24. // send mail with defined transport object
  25. transporter.sendMail(mailOptions, (error, info) => {
  26. if (error) {
  27. return console.log(error);
  28. }
  29. console.log("Message sent: %s", info.messageId);
  30. // Preview only available when sending through an Ethereal account
  31. console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
  32. });
Add Comment
Please, Sign In to add comment