send-mail-for-test
v1.1.0
Published
使用nodemailer套件模組化 SMTP Email 寄送功能,降低未來維護的成本。
Downloads
6
Readme
send-mail-for-test
描述
使用nodemailer套件模組化 SMTP Email 寄送功能,降低未來維護的成本。
功能
- SMTP Server 的位置與身份驗證是可變動的
- 需可寄送 HTML 內文
- 內文可附加圖片
- 可夾帶檔案
install
npm install send-mail-for-test --save
constructor
const param: MailCredentialParameter = {
host: "smtp.gmail.com",
port: 465,
enableSSL: true,
user: "[email protected]",
password: "password"
};
const mailUtil = new MailUtil(param);
function
const option: MailOptionParameter = {
from: "[email protected]",
to: ["[email protected]"],
subject: "test",
text:"hi",
attachments: [{
filename: "",
path:""
}, {
filename: "",
path:"",
cid: "" // if want to show image
}]};
mailUtil.sendMail(option).then((res: Result) => {
console.log(res);
});