@pilotoo/connections-mail
Introduction
Section titled “Introduction”@pilotoo/connections-mail implements the MailTransport port that the Email (IMAP/SMTP) provider of @pilotoo/connections-core needs. SMTP goes through nodemailer and IMAP through imapflow. Before it opens a connection it refuses a host that resolves to a private, loopback or link-local address and any port outside the mail ports.
Installation
Section titled “Installation”@pilotoo/connections-mail is at version 0.1.0, is marked private and is not published to a registry. It is also not part of the tarballs that pnpm release:check packs, so today it is used from the kit workspace:
pnpm installpnpm --filter @pilotoo/connections-mail buildInside the workspace, depend on it with "@pilotoo/connections-mail": "workspace:^". Its build first builds the kit packages it depends on.
Basic usage
Section titled “Basic usage”Create the transport and pass it next to the providers:
import { mailProvider } from '@pilotoo/connections-core';import { createMailTransport } from '@pilotoo/connections-mail';
PilotooModule.forRoot({ connections: { providers: [mailProvider()], mail: createMailTransport(), tools: true, },});| Option | Default | Meaning |
|---|---|---|
allowPrivateHosts |
false |
Allow loopback, private and link-local hosts. The mail ports stay enforced. |
timeoutMs |
20000 |
Deadline of each operation. |
resolve, imapClient and smtpTransport replace DNS resolution and the two library clients; they exist for tests.
The provider, its tools and its credential fields are described in Providers.
Entry points
Section titled “Entry points”| Import | Provides |
|---|---|
@pilotoo/connections-mail |
createMailTransport and the types MailTransportOptions, ImapOptions, ImapClientFactory, ImapClientLike, SmtpOptions, SmtpTransportFactory, SmtpTransporter and Resolve. |
Dependencies
Section titled “Dependencies”@pilotoo/connections-core, nodemailer, imapflow and mailparser. It has no peer dependencies.
Learn more
Section titled “Learn more”- Providers for the Email provider.
- Using the library.