emailer.model.ts 915 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. type From = string | { name?: string, address: string }
  2. interface Base extends Partial<SendEmailDefaultMessageOptions> {
  3. to: string[] | string
  4. }
  5. interface MailTemplate extends Base {
  6. template: string
  7. locals?: { [key: string]: any }
  8. text?: undefined
  9. }
  10. interface MailText extends Base {
  11. text: string
  12. locals?: Partial<SendEmailDefaultLocalsOptions> & {
  13. title?: string
  14. action?: {
  15. url: string
  16. text: string
  17. }
  18. }
  19. }
  20. interface SendEmailDefaultLocalsOptions {
  21. instanceName: string
  22. text: string
  23. subject: string
  24. }
  25. interface SendEmailDefaultMessageOptions {
  26. to: string[] | string
  27. from: From
  28. subject: string
  29. replyTo: string
  30. }
  31. export type SendEmailDefaultOptions = {
  32. template: 'common'
  33. message: SendEmailDefaultMessageOptions
  34. locals: SendEmailDefaultLocalsOptions & {
  35. WEBSERVER: any
  36. EMAIL: any
  37. }
  38. }
  39. export type SendEmailOptions = MailTemplate | MailText