# Variable email

email: {
emailMockReqRes: {
req: {
__: (s: any) => any;
body: string;
csrfToken: () => string;
flash: (...fs: any) => void;
generate_email: boolean;
get: (s: string) => string;
get_base_url: () => any;
getLocale: () => any;
headers: {};
isAuthenticated: () => boolean;
query: {};
user: { attributes: {}; id: number; role_id: number };
xhr: boolean;
};
res: {
__: (s: any) => any;
sendWrap: (...sw: any[]) => void;
json(o: any): void;
redirect(url: string): void;
send(s: any): void;
status(st: any): void;
};
};
getFileAggregations: (table: Table) => Promise<string[]>;
getMailTransport: () => Promise<MicosoftGraphTransporter | Transporter>;
getOauth2Client: (
__namedParameters?: {
authorizeUrl: string;
clientId: string;
clientSecret: string;
tokenUrl: string;
},
) => AuthorizationCode<"client_id">;
getTokenString: () => Promise<string>;
loadAttachments: (
path: string,
row: any,
user: any,
) => Promise<{ path: string }[]>;
mjml2html: (
input: string | MJMLJsonObject,
options?: MJMLParsingOptions,
) => MJMLParseResults;
send_verification_email: (
user: User,
req?: any,
opts?: { new_verification_token?: string },
) => Promise<any>;
viewToEmailHtml: (
view: View,
state: any,
options?: { locale?: string },
) => Promise<string>;
viewToMjml: (
view: View,
state: any,
options?: { locale?: string },
) => Promise<any>;
}

#### Type Declaration

- ##### emailMockReqRes: {
  req: {
  __: (s: any) => any;
  body: string;
  csrfToken: () => string;
  flash: (...fs: any) => void;
  generate_email: boolean;
  get: (s: string) => string;
  get_base_url: () => any;
  getLocale: () => any;
  headers: {};
  isAuthenticated: () => boolean;
  query: {};
  user: { attributes: {}; id: number; role_id: number };
  xhr: boolean;
  };
  res: {
  __: (s: any) => any;
  sendWrap: (...sw: any[]) => void;
  json(o: any): void;
  redirect(url: string): void;
  send(s: any): void;
  status(st: any): void;
  };
  }

- ##### getFileAggregations: (table: Table) => Promise<string[]>

  look at aggreation relations pointing at 'table' and return File fields

- ##### getMailTransport: () => Promise<MicosoftGraphTransporter | Transporter>

- ##### getOauth2Client: (
  __namedParameters?: {
  authorizeUrl: string;
  clientId: string;
  clientSecret: string;
  tokenUrl: string;
  },
  ) => AuthorizationCode<"client_id">

- ##### getTokenString: () => Promise<string>

- ##### loadAttachments: (path: string, row: any, user: any) => Promise<{ path: string }[]>

  prepare an attachements array that can be used with nodemailer

- ##### mjml2html: (
  input: string | MJMLJsonObject,
  options?: MJMLParsingOptions,
  ) => MJMLParseResults

- ##### send_verification_email: (
  user: User,
  req?: any,
  opts?: { new_verification_token?: string },
  ) => Promise<any>

- ##### viewToEmailHtml: (view: View, state: any, options?: { locale?: string }) => Promise<string>

  run the view and create email formatted html

- ##### viewToMjml: (view: View, state: any, options?: { locale?: string }) => Promise<any>

- Defined in packages/saltcorn-data/models/email.ts:420