aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/models/server/emailer.model.ts
blob: 39512d306147b8e6ac5301ef5ca0d088af52cdb9 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                       
 





                                                                
                                 




                                 
 






                                                     
 

























                                                      
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