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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nodemailer 附件_如何使用Nodemailer发送带有附件的电子邮件。 Node.js

發布時間:2023/12/1 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nodemailer 附件_如何使用Nodemailer发送带有附件的电子邮件。 Node.js 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

nodemailer 附件

In the previous article, "How to send emails using Nodemailer?", we discussed how to send simple emails using Nodemailer in Node.js? Here, we are going to learn further – How to send emails with attachments using Nodemailer in Node.js?

在上一篇文章“ 如何使用Nodemailer發送電子郵件? ”中,我們討論了如何在Node.js中使用Nodemailer發送簡單的電子郵件? 在這里,我們將進一步學習– 如何使用Node.js中的Nodemailer發送帶有附件的電子郵件?

Here is the code to send emails with attachments using Nodemailer,

這是使用Nodemailer發送帶有附件的電子郵件的代碼,

// 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',text: 'sending email with attchments',// attachment. // you can use the same format and send as many attachments as possibleattachments: [ { filename: 'textfile.txt',path: 'C:/Users/GODWILL TETAH/Downloads/textfile.txt'} ] };transporter.sendMail(mailOptions, function(error, info){if (error) {console.log(error);} else {console.log('Email sent');} });

To add attachment from a cloud storage system online, you can use the URL,

要在線從云存儲系統添加附件,您可以使用以下網址,

{ // use URL as an attachmentfilename: 'license.txt',path: 'https://raw.github.com/nodemailer/nodemailer/master/LICENSE' },

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 (,).

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

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

最后,啟動您的節點應用程序,如果發送成功,則將在控制臺或終端上打印出短語“已發送電子郵件”。

Check you're the email's inbox.

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

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

使用Gmail作為傳輸者,您還可以啟用安全性較低的應用訪問設置。

Sending email requires internet connection.

發送電子郵件需要互聯網連接。

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

不要擔心您的密碼安全性。 自2010年以來,它已被許多人使用并經過測試和保護。

Also, don't forget the comma sign (,) that kind of separates the text content and the attachment.

另外,請不要忘記用逗號(,)分隔文本內容和附件。

It gave me some hard time when preparing this article.

在編寫本文時,這給了我一些困難。

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

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

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

nodemailer 附件

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。