wallet-svr/src/service/email.svr.ts
2023-03-15 16:21:12 +08:00

38 lines
1.1 KiB
TypeScript

import {singleton} from "decorators/singleton";
import { NetClient} from "net/NetClient";
export const DEFAULT_VERIFY_HTML =
`
<h1>Email Verification</h1>
<p>CEBG needs to confirm your email address is still valid. Please click the link below to confirm you received this mail.</p>
<p><a href="{{href}}" target="_blank">Verify Email</a></p>
<p>If you're worried about this email being legitimate, you can visit CEBG directly to confirm your email needs verifying. After doing so, please don't forget to click the link above.</p>
`
export interface IMailData {
from?: string
to: string
subject?: string
text?: string
html?: string
}
const DEFAULT_MSG_DATA: IMailData = {
from: '自己人 <zhl010101@163.com>',
to: '',
subject: 'Please verify your email address'
}
const MAIL_SVR = 'http://127.0.0.1:3087'
@singleton
export class EmailSvr {
public sendMail(msg: IMailData) {
Object(DEFAULT_MSG_DATA).zssign(msg)
let reqData = {
url: MAIL_SVR+'/mail/send',
data: JSON.stringify({message: msg})
}
return new NetClient().httpPost(reqData)
}
}