当前位置:网站首页>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)
边栏推荐
- 【Qt】error: QApplication: No such file or directory 解决方案
- SAP SMARTFORMS文本内容手动换行输出
- How to change the administrator's Avatar in win11? Win11 method of changing administrator image
- Initialize the one-dimensional array a correctly
- Tencent test development post interview programming questions
- Shell learning tutorial (super detailed and complete)
- During SSH configuration key login, you need to pay attention to whether the private key is set with a password
- npm ERR Fix the upstream dependency conflict, or retry
- Secret
- The annual salary of testers in large factories ranges from 300000 to 8K a month. Roast complained that the salary was too low, but he was ridiculed by netizens?
猜你喜欢

Using an old mobile phone to build a server and achieve intranet penetration does not require root (I have personally tested the simplest one many times)

可扩/减容线程池C语言原理讲解及代码实现

软件测试面试复盘:技术面没有难倒我,hr面却是一把挂

接口自动化核心知识点浓缩,为面试加分

FB02编辑Coding Block字段

QT database learning notes (I) basic concepts of database

Understanding of pointers

421. 数组中两个数的最大异或值

技术分享| 快对讲,全球对讲

14:00面试,14:08就出来了 ,问的实在是太...
随机推荐
优化调度(火电、风能、储能)【matlab代码实现】
Introduction and practice of QT tcp/udp network protocol (II) UDP communication
Can the soft exam certificate be settled in Shanghai? Many people don't know
渗透测试-安全服务体系+OWASP top 10
[matlab] image compression coding (DCT, RLE)
[music] playing blue and white porcelain based on MATLAB [including Matlab source code 1873]
Talk about an annotation implementation interface retry
Switch case uses enumeration classes to compare
SAP smartforms page feed printing automatic judgment
Sword finger offer II 095 Longest common subsequence dynamic programming
Asemi FET 12n65 parameters, 12n65 specifications, 12n65 features
ABAP CDs realizes multi line field content splicing
从测试零基础到测试架构师,这10年,他是这样让自己成才的
(solved) latex -- cancel the superscript display of references in the text (gbt7714-2015 will lead to the default superscript reference) (tutorial on mixed use of superscript and flush)
378. 有序矩阵中第 K 小的元素
[3.delphi common components] 8 dialog box
Contest2902 - following Tang Kelian's programming: sequence structure question d: area 201502 question f: persistence of supporting college students in Ludian earthquake
Understand the role of before and after Clearfixafter clear floating
为什么有的程序员能力一般却能拿到好offer?
ABAP CDS实现多行字段内容拼接