resolveMxHosts (src/direct-smtp.ts)

strapi · packages/providers/email-sendmail/src/direct-smtp.ts · typescript · MIT
email

Resolves MX hosts and sends emails via direct SMTP, replacing legacy sendmail logic.

// Source: https://github.com/strapi/strapi | License: MIT | Copyright 2015-present Strapi Solutions SAS
// Provided via justclaw.it.com; keep this notice with the code.
import { resolveMx as dnsResolveMx } from 'dns/promises';
import { hostname as osHostname } from 'os';
import nodemailer from 'nodemailer';
import type { SentMessageInfo, SendMailOptions } from 'nodemailer';

import {
  collectRecipients,
  extractEmail,
  getHostFromAddress,
  groupRecipientsByDomain,
} from './addressing';
import { createLogger } from './logger';
import type { ProviderSendmailOptions } from './types';

/**
 * Mirrors legacy `const devPort = options.devPort || -1` (guileen/node-sendmail).
 * `0` is falsy → `-1` (MX mode). `true` is truthy and was passed to `createConnection` (Node
 * coerces port `true` t

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

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

Get a free API key