aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/server/emailer.model.ts
blob: 39512d306147b8e6ac5301ef5ca0d088af52cdb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
type From = string | { name?: string, address: string }

interface Base extends Partial<SendEmailDefaultMessageOptions> {
  to: string[] | string
}

interface MailTemplate extends Base {
  template: string
  locals?: { [key: string]: any }
  text?: undefined
}

interface MailText extends Base {
  text: string

  locals?: Partial<SendEmailDefaultLocalsOptions> & {
    title?: string
    action?: {
      url: string
      text: string
    }
  }
}

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