Skip to content

Commit

Permalink
添加email服务
Browse files Browse the repository at this point in the history
  • Loading branch information
baozhoutao committed Jul 30, 2024
1 parent 915aa39 commit 2b2e131
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions services/standard-space/main/default/services/email.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* @Author: [email protected]
* @Date: 2024-07-30 13:43:46
* @LastEditors: [email protected]
* @LastEditTime: 2024-07-30 13:49:42
* @Description:
*/
"use strict";
/**
* @typedef {import('moleculer').Context} Context Moleculer's Context
*/
module.exports = {
name: 'email',
namespace: "steedos",
/**
* Settings
*/
settings: {

},

/**
* Dependencies
*/
dependencies: [],

/**
* Actions
*/
actions: {
send: {
params: {
from: { type: "string", optional: true },
to: { type: "string", optional: true },
subject: { type: "string", optional: true },
body: { type: "string" },
},
async handler(ctx) {
const options = ctx.params
try {
Fiber(function () {
MailQueue.send({
from: options.from,
to: options.to,
subject: options.subject,
html: options.body,
});
}).run();
} catch (error) {
console.error('发送邮件失败:', error);
}
}
},
}
};

0 comments on commit 2b2e131

Please sign in to comment.