MailSender (mail/sender.ts)

AFFiNE · packages/backend/server/src/core/mail/sender.ts · typescript · MIT
email

Module exposing: MailSender, configToSMTPOptions

// Source: https://github.com/toeverything/AFFiNE | License: MIT | Copyright 2022-present TOEVERYTHING PTE. LTD. and its affiliates
// Provided via justclaw.it.com; keep this notice with the code.
import { Injectable, Logger } from '@nestjs/common';
import {
  createTestAccount,
  createTransport,
  getTestMessageUrl,
  SendMailOptions,
  Transporter,
} from 'nodemailer';
import SMTPTransport from 'nodemailer/lib/smtp-transport';

import { Config, metrics, OnEvent } from '../../base';
import { resolveSMTPHeloHostname } from './utils';

export type SendOptions = Omit<SendMailOptions, 'to' | 'subject' | 'html'> & {
  to: string;
  subject: string;
  html: string;
};

export type MailSendResult =
  | {
      status: 'accepted';
      providerMessageId?: string;
      providerResponse?: string

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key