unimail-node-sdk
v1.0.0
Published
node client sdk for unimail
Downloads
202
Readme
unimail-node-sdk
The current SDK version is v2. If you need to use the previous v1 version, please switch to the v1 branch.
This is a Node SDK for Unimail. Quickly integrate into your project
usage
- init a unimail client
add the package
npm install unimail-node-sdkconst { Unimail, UnimailReq } = require("unimail-node-sdk");
var unimail = new Unimail("your_api_key");
var res = await unimail.checkConnection();
console.log(res, res.isSuccess());- send email
const req = new UnimailReq({
from: "Notice",
receivers: ["email"],
// Cc: "",
// Bcc: "",
subject: "test",
// txtContent: "node sdk test",
htmlContent: "<h1>node sdk test <span style='color:red'>red font</span></h1>",
});
// add file resource
req.appendFile("attachment.txt", fs.readFileSync("test/attachment.txt"));
var res = await unimail.sendEmail(req);
console.log(res, res.isSuccess());api docs
- Unimail(key)
init a client by key
- client.setHost(host)
set host for the client
- client.setLang(lang)
set language for the client,default is zh
- client.CheckConnect()
check the host and key is ok
- client.SendEmail(UnimailReq)
please see usage
support language
chinese is the default language for the sdk.
- [x] english (en)
- [x] simple chinese (zh)
- [x] vietnamese (vi)
- [x] idonesian (id)
- [x] thai (th)
- [x] gujarati (gu)
if you want to support other language, please open a issue.
- tips
If you want to use this SDK, please contact the author.
