|
|
2 days ago | |
|---|---|---|
| .. | ||
| .vscode | 2 days ago | |
| assets | 2 days ago | |
| src | 2 days ago | |
| submodule | 2 days ago | |
| test | 2 days ago | |
| .dockerignore | 2 days ago | |
| .eslintrc.js | 2 days ago | |
| .gitignore | 2 days ago | |
| .prettierrc | 2 days ago | |
| Dockerfile | 2 days ago | |
| README.md | 2 days ago | |
| nest-cli.json | 2 days ago | |
| package-lock.json | 2 days ago | |
| package.json | 2 days ago | |
| tsconfig.build.json | 2 days ago | |
| tsconfig.json | 2 days ago | |
Template:
b. When you use the template, you will call mailerService.sendMail(sendMailOptions),and in 'sendMailOptions' have a attribute "content", that is "locals":
const sendMailOptions: ISendMailOptions = {
to: data.receiver,
subject: data.subject || '用户邮箱验证',
template: 'test.ejs',
context: {
date, //日期
text:data.text,
}
};
c. This is use "locals" example:
<p style="color: #dde2e2;padding-left: 14px;">
<strong style="color: #3acbff;font-size: 24px;">
<%= locals.text %>
</strong>
<span>(If the text same as your input, then i am health)</span>
</p>
Tips: ❌ locals.context.text ✅ locals.text More : https://ejs.bootcss.com/#docs
Config
API
Tips: it no real use in project, just listing the service should to do.
Base URLs: https://localhost:12500
POST /email/test
Body 请求参数
{
"content": "string",
"subject": "string",
"template": "string",
"receiver": "string"
}
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | SingleEmailBody | 否 | none |
返回示例
201 Response
{}
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 201 | Created | 成功 | Inline |
POST /email/single
Body 请求参数
{
"content": "string",
"subject": "string",
"template": "string",
"receiver": "string"
}
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | SingleEmailBody | 否 | none |
返回示例
201 Response
{}
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 201 | Created | 成功 | Inline |
POST /email/multiple
Body 请求参数
{
"content": "string",
"subject": "string",
"template": "string",
"receiver": ["string"]
}
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| body | body | MultipleEmailBody | 否 | none |
返回示例
201 Response
{}
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 201 | Created | 成功 | Inline |
GET /email
返回示例
200 Response
{}
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功 | Inline |
GET /email/hi
返回示例
200 Response
{}
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功 | Inline |
{
"content": "string",
"subject": "string",
"template": "string",
"receiver": ["string"]
}
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| content | string | true | none | none | |
| subject | string | true | none | none | |
| template | string | true | none | none | |
| receiver | [string] | true | none | none |
{
"content": "string",
"subject": "string",
"template": "string",
"receiver": "string"
}
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| content | string | true | none | none | |
| subject | string | true | none | none | |
| template | string | true | none | none | |
| receiver | string | true | none | none |