2021-03-12 04:22:17 -05:00
|
|
|
type From = string | { name?: string, address: string }
|
2020-04-23 03:32:53 -04:00
|
|
|
|
2021-03-12 04:22:17 -05:00
|
|
|
interface Base extends Partial<SendEmailDefaultMessageOptions> {
|
|
|
|
to: string[] | string
|
|
|
|
}
|
|
|
|
|
|
|
|
interface MailTemplate extends Base {
|
|
|
|
template: string
|
2020-05-05 14:22:22 -04:00
|
|
|
locals?: { [key: string]: any }
|
2021-03-12 04:22:17 -05:00
|
|
|
text?: undefined
|
|
|
|
}
|
|
|
|
|
|
|
|
interface MailText extends Base {
|
|
|
|
text: string
|
2020-05-05 14:22:22 -04:00
|
|
|
|
2021-03-12 04:22:17 -05:00
|
|
|
locals?: Partial<SendEmailDefaultLocalsOptions> & {
|
|
|
|
title?: string
|
|
|
|
action?: {
|
|
|
|
url: string
|
|
|
|
text: string
|
|
|
|
}
|
|
|
|
}
|
2020-04-23 03:32:53 -04:00
|
|
|
}
|
2021-03-12 04:22:17 -05:00
|
|
|
|
|
|
|
interface SendEmailDefaultLocalsOptions {
|
|
|
|
instanceName: string
|
|
|
|
text: string
|
|
|
|
subject: string
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SendEmailDefaultMessageOptions {
|
|
|
|
to: string[] | string
|
|
|
|
from: From
|
|
|
|
subject: string
|
|
|
|
replyTo: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type SendEmailDefaultOptions = {
|
|
|
|
template: 'common'
|
|
|
|
|
|
|
|
message: SendEmailDefaultMessageOptions
|
|
|
|
|
|
|
|
locals: SendEmailDefaultLocalsOptions & {
|
|
|
|
WEBSERVER: any
|
|
|
|
EMAIL: any
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export type SendEmailOptions = MailTemplate | MailText
|