日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

nodemailer使用_如何使用Nodemailer使用HTML作为内容发送电子邮件 Node.js

發(fā)布時間:2025/3/11 HTML 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nodemailer使用_如何使用Nodemailer使用HTML作为内容发送电子邮件 Node.js 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

nodemailer使用

Prerequisite:

先決條件:

  • How to send emails using Nodemailer | Node.js

    如何使用Nodemailer發(fā)送電子郵件。 Node.js

  • How to send emails with attachments using Nodemailer | Node.js

    如何使用Nodemailer發(fā)送帶有附件的電子郵件。 Node.js

  • This time around, we will see how to compose or build/format our email body using HTML?

    這次,我們將看到如何使用HTML編寫或構(gòu)建/格式化電子郵件正文?

    Code:

    碼:

    // load the node mailer module var nodemailer = require('nodemailer'); //configure the transportervar transporter = nodemailer.createTransport({ service: 'gmail',auth: {user: '[email?protected]',pass: 'your gmail password'} });//email optionsvar mailOptions = {from: '[email?protected]',to: '[email?protected]',subject: 'Sending Email using Node.js',html: '<h1> Node JS </h1> <br> <h5> Hello World</h5>' };transporter.sendMail(mailOptions, function(error, info){if (error) {console.log(error);} else {console.log('Email sent');} });

    Note: You can use the same format and send as many attachments as possible. Make sure the closing curly bracket of each attachment is separated by a comma sign (,).

    注意:您可以使用相同的格式并發(fā)送盡可能多的附件。 確保每個附件的大括號用逗號(,)分隔。

    Finally, start your node app and if sending is successful, the phrase ‘email sent' will be printed out on the console or terminal.

    最后,啟動您的節(jié)點(diǎn)應(yīng)用程序,如果發(fā)送成功,則將在控制臺或終端上打印出短語“已發(fā)送電子郵件”。

    Check you're the email's inbox.

    檢查您是否是電子郵件的收件箱。

    Using Gmail as your transporter, you can also enable the less secure app access setting.

    使用Gmail作為傳輸者,您還可以啟用安全性較低的應(yīng)用訪問設(shè)置。

    Sending email requires internet connection.

    發(fā)送電子郵件需要互聯(lián)網(wǎng)連接。

    Do not fear about your password security. It's a tested and secured module used by many since 2010.

    不要擔(dān)心您的密碼安全性。 自2010年以來,它已被許多人使用并經(jīng)過測試和保護(hù)。

    Thanks for coding with me! See you @ the next article. Feel free to drop a comment or question.

    感謝您與我編碼! 下次見。 隨意發(fā)表評論或問題。

    翻譯自: https://www.includehelp.com/node-js/how-to-send-emails-with-nodemailer-using-html-as-content-node-js.aspx

    nodemailer使用

    總結(jié)

    以上是生活随笔為你收集整理的nodemailer使用_如何使用Nodemailer使用HTML作为内容发送电子邮件 Node.js的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。