mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
use new mail service in dashboard
This commit is contained in:
18
dashboard/server/services/EmailServiceHelper.ts
Normal file
18
dashboard/server/services/EmailServiceHelper.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
import { EmailServerInfo } from '@services/EmailService'
|
||||
|
||||
const { EMAIL_SECRET } = useRuntimeConfig();
|
||||
|
||||
export class EmailServiceHelper {
|
||||
static async sendEmail(data: EmailServerInfo) {
|
||||
try {
|
||||
await $fetch(data.url, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data.body),
|
||||
headers: { ...data.headers, 'x-litlyx-token': EMAIL_SECRET }
|
||||
})
|
||||
} catch (ex) {
|
||||
console.error(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user