当前位置:网站首页>Nodejs send mail
Nodejs send mail
2022-06-11 02:16:00 【KjPrime】
Turn on POP3/SMTP service
- Here are the QQ Mailbox is an example , Other e-mail addresses are Baidu

nodejs Code
- install
nodemailerrely on
npm install nodemailer
- Code
/** * @author kjprime * @description Send E-mail */
const nodemailer = require("nodemailer")
const config = {
host: 'smtp.qq.com', // use QQ Just use this. , If other mailboxes , It needs to be replaced
port: 465, // port
auth: {
user: '[email protected]', // account number
pass: 'password' // Authorization code or password
},
secure: true
}
const server = nodemailer.createTransport(config)
const mail = {
from: '[email protected]',
to: '[email protected]',
//text: ' I'm a test file ',
html: "<h1> I'm the headline </h1> <div> I am content. </div>",
subject: " Mailbox validation " // Email title
}
const Callback = function(err, msg) {
// Callback function
if (err) {
console.log(" fail in send ")
}
else{
console.log(" Send successfully ")
console.log(msg)
}
}
// Start sending mail
server.sendMail(mail, Callback)
边栏推荐
- [music] playing blue and white porcelain based on MATLAB [including Matlab source code 1873]
- Task07: double pointer
- Alibaba cloud Tianchi online programming training camp_ Task arrangement
- Union find
- SAP smartforms page feed printing automatic judgment
- Elsevier ---elseviewer--- preprint online publishing notice
- Oracle collects statistics
- 接口自动化核心知识点浓缩,为面试加分
- Method of using dism command to backup driver in win11 system
- Go develop web
猜你喜欢

ACM tutorial - heap sorting
![[winning] Title A of the 9th Teddy Cup Challenge](/img/86/8445c4ac47d4fa7630544984fa0c58.jpg)
[winning] Title A of the 9th Teddy Cup Challenge

In the past 10 years, from zero foundation testing to test architect, he has made himself successful

JS basic part hand exercises

Oracle collects statistics

Internet of things final assignment - sleep quality detection system (refined version)

QT database learning notes (I) basic concepts of database

The interviewer of Tencent said that who knows the internal module index principle and performance optimization idea of MySQL architecture?
![Md61 plan independent demand import Bapi [by daily dimension / dynamic template / dynamic field]](/img/28/2a4fd7f019f6528bd322c5e75ecaa7.png)
Md61 plan independent demand import Bapi [by daily dimension / dynamic template / dynamic field]

2022 safety officer-a certificate special operation certificate examination question bank and simulation examination
随机推荐
Jump without refresh - detailed explanation of pushstate and replacestate methods in history
14:00面试,14:08就出来了 ,问的实在是太...
What should be paid attention to in PMP registration? Special reminder
【Qt】error: QApplication: No such file or directory 解决方案
Is it appropriate for a 27 - year-old girl to change her career from zero to software testing?
CRS-4544 & ORA-09925
Switch case uses enumeration classes to compare
Project sorting of Online Exercise System Based on gin and Gorm
Task06: bit operation
Introduction and practice of QT tcp/udp network protocol (I) TCP communication
Orcale driver
MD61计划独立需求导入BAPI【按日维度/动态模板/动态字段】
[matlab] image enhancement (power transformation, histogram specification processing method, smoothing and sharpening filtering)
Task01: array
QT widget's simple serial port assistant (qserialport)
Elsevier ---elseviewer--- preprint online publishing notice
[3.delphi common components] 8 dialog box
Secret
CRS-5017
NFT Insider #61:Animoca Brands 在 340 项投资中持有 15 亿美元的加密资产