Docs/API Reference/Packages

@veap/mail

Inspected version: 0.1.3 · Source

2 min read

Inspected version: 0.1.3 · Source →

A transport-neutral email facade with console, Nodemailer and custom transport support.

Entry point#

The manifest exports only the root and /package.json. Root exports the composition/provider APIs, mail context, sendMail helpers, message contracts, mailer ports, built-in providers and translator integration.

Main exports#

  • sendMail(message: MailMessage): Promise<void>
  • sendVerifyEmail(email, code)
  • sendResetPassword(email, code)
  • sendRecoveryCode(email, recoveryCode)
  • send2FACode(email, code)
  • MailMessage, MailRecipient, MailAddress, MailAttachment
  • IMailer, MAILER, backward-compatible MAIL_SERVICE, CUSTOM_MAILER
  • CommunicationServiceProvider, alias MailServiceProvider
  • ConsoleMailService, NodemailerMailService

Message types#

MailMessage supports to, subject, optional text, html, from, cc, bcc, replyTo, attachments, priority and custom headers. A recipient is a string address or { name?, address }. An attachment can include filename, content or path, contentType, cid and encoding; inline content and path are mutually exclusive.

Transport selection#

The provider uses MAIL_TRANSPORT:

  • smtp: Nodemailer delivery.
  • console: logs messages for local development/test.
  • custom: resolves an IMailer implementation under CUSTOM_MAILER.

If no transport, SMTP credentials or host/service are configured, the inspected provider warns and defaults to console delivery. Explicitly configure and test a real transport in production.

Environment variables#

Observed names include MAIL_TRANSPORT, MAIL_SERVICE, MAIL_HOST, MAIL_PORT, MAIL_SECURE, MAIL_IGNORE_TLS, MAIL_USERNAME, MAIL_PASSWORD, GOOGLE_SMTP_APP_USERNAME, GOOGLE_SMTP_APP_PASSWORD, MAIL_FROM_ADDRESS, and MAIL_FROM_NAME.

Extension contract#

IMailer exposes one operation: sendMail(message: MailMessage): Promise<void>. Implement provider-specific SDK translation in the adapter, not in business services. For the full pattern, see custom transport.

veap
Preparing0%