2021-03-12 10:22:17 +01:00
|
|
|
type From = string | { name?: string, address: string }
|
2020-04-23 09:32:53 +02:00
|
|
|
|
2021-03-12 10:22:17 +01:00
|
|
|
interface Base extends Partial<SendEmailDefaultMessageOptions> {
|
|
|
|
to: string[] | string
|
|
|
|
}
|
|
|
|
|
|
|
|
interface MailTemplate extends Base {
|
|
|
|
template: string
|
2020-05-05 20:22:22 +02:00
|
|
|
locals?: { [key: string]: any }
|
2021-03-12 10:22:17 +01:00
|
|
|
text?: undefined
|
|
|
|
}
|
|
|
|
|
|
|
|
interface MailText extends Base {
|
|
|
|
text: string
|
2020-05-05 20:22:22 +02:00
|
|
|
|
2021-03-12 10:22:17 +01:00
|
|
|
locals?: Partial<SendEmailDefaultLocalsOptions> & {
|
|
|
|
title?: string
|
|
|
|
action?: {
|
|
|
|
url: string
|
|
|
|
text: string
|
|
|
|
}
|
|
|
|
}
|
2020-04-23 09:32:53 +02:00
|
|
|
}
|
2021-03-12 10:22:17 +01: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
|