nodemailer/000755 001751 001751 0000000000 15146137154014674 5ustar00runner000000 000000 1514613715415146137154nodemailer/LICENSE000644 001751 001751 0000002165 15146137154015705 0ustar00runner000000 000000 1514613715415146137154 MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE nodemailer/README.md000644 001751 001751 0000001167 15146137154016160 0ustar00runner000000 000000 1514613715415146137154# Installation > `npm install --save @types/nodemailer` # Summary This package contains type definitions for nodemailer (https://github.com/nodemailer/nodemailer). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer. ### Additional Details * Last updated: Fri, 20 Feb 2026 20:05:00 GMT * Dependencies: [@types/node](https://npmjs.com/package/@types/node) # Credits These definitions were written by [Rogier Schouten](https://github.com/rogierschouten), [Piotr Roszatycki](https://github.com/dex4er), and [Daniel Chao](https://github.com/bioball). nodemailer/index.d.ts000644 001751 001751 0000006244 15146137154016603 0ustar00runner000000 000000 1514613715415146137154/// import JSONTransport = require("./lib/json-transport"); import Mail = require("./lib/mailer"); import MailMessage = require("./lib/mailer/mail-message"); import SendmailTransport = require("./lib/sendmail-transport"); import SESTransport = require("./lib/ses-transport"); import SMTPPool = require("./lib/smtp-pool"); import SMTPTransport = require("./lib/smtp-transport"); import StreamTransport = require("./lib/stream-transport"); export type SendMailOptions = Mail.Options; export type Transporter = Mail; export type SentMessageInfo = any; export interface Transport { mailer?: Transporter | undefined; name: string; version: string; send(mail: MailMessage, callback: (err: Error | null, info: T) => void): void; verify?(callback: (err: Error | null, success: true) => void): void; verify?(): Promise; close?(): void; } export interface TransportOptions { component?: string | undefined; } export interface TestAccount { user: string; pass: string; smtp: { host: string; port: number; secure: boolean }; imap: { host: string; port: number; secure: boolean }; pop3: { host: string; port: number; secure: boolean }; web: string; } export function createTransport( transport: SMTPPool | SMTPPool.Options, defaults?: SMTPPool.Options, ): Transporter; export function createTransport( transport: SendmailTransport | SendmailTransport.Options, defaults?: SendmailTransport.Options, ): Transporter; export function createTransport( transport: StreamTransport | StreamTransport.Options, defaults?: StreamTransport.Options, ): Transporter; export function createTransport( transport: JSONTransport | JSONTransport.Options, defaults?: JSONTransport.Options, ): Transporter; export function createTransport( transport: SESTransport | SESTransport.Options, defaults?: SESTransport.Options, ): Transporter; export function createTransport( transport?: SMTPTransport | SMTPTransport.Options | string, defaults?: SMTPTransport.Options, ): Transporter; // eslint-disable-next-line @definitelytyped/no-unnecessary-generics export function createTransport( transport: Transport | TransportOptions, defaults?: TransportOptions, ): Transporter; export function createTestAccount( apiUrl: string, callback: (err: Error | null, testAccount: TestAccount) => void, ): void; export function createTestAccount(callback: (err: Error | null, testAccount: TestAccount) => void): void; export function createTestAccount(apiUrl?: string): Promise; export function getTestMessageUrl(info: SESTransport.SentMessageInfo | SMTPTransport.SentMessageInfo): string | false; nodemailer/lib/000755 001751 001751 0000000000 15146137154015442 5ustar00runner000000 000000 1514613715415146137154nodemailer/package.json000644 001751 001751 0000002217 15146137154017164 0ustar00runner000000 000000 1514613715415146137154{ "name": "@types/nodemailer", "version": "7.0.11", "description": "TypeScript definitions for nodemailer", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer", "license": "MIT", "contributors": [ { "name": "Rogier Schouten", "githubUsername": "rogierschouten", "url": "https://github.com/rogierschouten" }, { "name": "Piotr Roszatycki", "githubUsername": "dex4er", "url": "https://github.com/dex4er" }, { "name": "Daniel Chao", "githubUsername": "bioball", "url": "https://github.com/bioball" } ], "main": "", "types": "index.d.ts", "repository": { "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", "directory": "types/nodemailer" }, "scripts": {}, "dependencies": { "@types/node": "*" }, "peerDependencies": {}, "typesPublisherContentHash": "e76773d11a21d4ae42dbd29143b55541f73cfcff05b046d87b9c8029771fa4d3", "typeScriptVersion": "5.2" }nodemailer/lib/addressparser/000755 001751 001751 0000000000 15146137154020304 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/base64/000755 001751 001751 0000000000 15146137154016526 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/dkim/000755 001751 001751 0000000000 15146137154016366 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/fetch/000755 001751 001751 0000000000 15146137154016533 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/json-transport/000755 001751 001751 0000000000 15146137154020445 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/mail-composer/000755 001751 001751 0000000000 15146137154020211 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/mailer/000755 001751 001751 0000000000 15146137154016713 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/mime-funcs/000755 001751 001751 0000000000 15146137154017505 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/mime-node/000755 001751 001751 0000000000 15146137154017314 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/qp/000755 001751 001751 0000000000 15146137154016062 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/sendmail-transport/000755 001751 001751 0000000000 15146137154021270 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/ses-transport/000755 001751 001751 0000000000 15146137154020266 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/shared/000755 001751 001751 0000000000 15146137154016710 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/smtp-connection/000755 001751 001751 0000000000 15146137154020562 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/smtp-pool/000755 001751 001751 0000000000 15146137154017374 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/smtp-transport/000755 001751 001751 0000000000 15146137154020457 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/stream-transport/000755 001751 001751 0000000000 15146137154020767 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/well-known/000755 001751 001751 0000000000 15146137154017537 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/xoauth2/000755 001751 001751 0000000000 15146137154017034 5ustar00runner000000 000000 1514613715415146137154nodemailer/lib/addressparser/index.d.ts000644 001751 001751 0000001310 15146137154022200 0ustar00runner000000 000000 1514613715415146137154declare namespace addressparser { interface Address { name: string; address: string; } interface Group { name: string; group: Address[]; } type AddressOrGroup = Address | Group; } /** * Parses structured e-mail addresses from an address field * * Example: * * 'Name ' * * will be converted to * * [{name: 'Name', address: 'address@domain'}] * * @return An array of address objects */ declare function addressparser(address: string, options: { flatten: true }): addressparser.Address[]; declare function addressparser(address: string, options?: { flatten: false }): addressparser.AddressOrGroup[]; export = addressparser; nodemailer/lib/base64/index.d.ts000644 001751 001751 0000001110 15146137154020420 0ustar00runner000000 000000 1514613715415146137154/// import { Transform, TransformOptions } from "stream"; /** Encodes a Buffer into a base64 encoded string */ export function encode(buffer: Buffer | string): string; /** Adds soft line breaks to a base64 string */ export function wrap(str: string, lineLength?: number): string; export interface EncoderOptions extends TransformOptions { lineLength?: number | false | undefined; } export class Encoder extends Transform { options: EncoderOptions; inputBytes: number; outputBytes: number; constructor(options?: EncoderOptions); } nodemailer/lib/dkim/index.d.ts000644 001751 001751 0000003762 15146137154020277 0ustar00runner000000 000000 1514613715415146137154/// import { PassThrough, Readable } from "stream"; declare namespace DKIM { interface OptionalOptions { /** optional location for cached messages. If not set then caching is not used. */ cacheDir?: string | false | undefined; /** optional size in bytes, if message is larger than this treshold it gets cached to disk (assuming cacheDir is set and writable). Defaults to 131072 (128 kB). */ cacheTreshold?: number | undefined; /** optional algorithm for the body hash, defaults to ‘sha256’ */ hashAlgo?: string | undefined; /** an optional colon separated list of header keys to sign (eg. message-id:date:from:to...') */ headerFieldNames?: string | undefined; /** optional colon separated list of header keys not to sign. This is useful if you want to sign all the relevant keys but your provider changes some values, ie Message-ID and Date. In this case you should use 'message-id:date' to prevent signing these values. */ skipFields?: string | undefined; } interface SingleKeyOptions extends OptionalOptions { /** is the domain name to use in the signature */ domainName: string; /** is the DKIM key selector */ keySelector: string; /** is the private key for the selector in PEM format */ privateKey: string | { key: string; passphrase: string }; } interface MultipleKeysOptions extends OptionalOptions { /** is an optional array of key objects (domainName, keySelector, privateKey) if you want to add more than one signature to the message. If this value is set then the default key values are ignored */ keys: SingleKeyOptions[]; } type Options = SingleKeyOptions | MultipleKeysOptions; } declare class DKIM { options: DKIM.Options; keys: DKIM.SingleKeyOptions[]; constructor(options?: DKIM.Options); sign(input: string | Buffer | Readable, extraOptions?: DKIM.Options): PassThrough; } export = DKIM; nodemailer/lib/dkim/message-parser.d.ts000644 001751 001751 0000007341 15146137154022103 0ustar00runner000000 000000 1514613715415146137154/// import { Transform } from "stream"; declare namespace MessageParser { interface Header { key: string; line: string; } } /** * MessageParser instance is a transform stream that separates message headers * from the rest of the body. Headers are emitted with the 'headers' event. Message * body is passed on as the resulting stream. */ declare class MessageParser extends Transform { addListener(event: "headers", listener: (headers: MessageParser.Header[]) => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: any) => void): this; addListener(event: "end", listener: () => void): this; addListener(event: "readable", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit(event: "headers", headers: MessageParser.Header[]): boolean; emit(event: "close"): boolean; emit(event: "data", chunk: any): boolean; emit(event: "end"): boolean; emit(event: "readable"): boolean; emit(event: "error", err: Error): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "headers", listener: (headers: MessageParser.Header[]) => void): this; on(event: "close", listener: () => void): this; on(event: "data", listener: (chunk: any) => void): this; on(event: "end", listener: () => void): this; on(event: "readable", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: "headers", listener: (headers: MessageParser.Header[]) => void): this; once(event: "close", listener: () => void): this; once(event: "data", listener: (chunk: any) => void): this; once(event: "end", listener: () => void): this; once(event: "readable", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener(event: "headers", listener: (headers: MessageParser.Header[]) => void): this; prependListener(event: "close", listener: () => void): this; prependListener(event: "data", listener: (chunk: any) => void): this; prependListener(event: "end", listener: () => void): this; prependListener(event: "readable", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: "headers", listener: (headers: MessageParser.Header[]) => void): this; prependOnceListener(event: "close", listener: () => void): this; prependOnceListener(event: "data", listener: (chunk: any) => void): this; prependOnceListener(event: "end", listener: () => void): this; prependOnceListener(event: "readable", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; removeListener(event: "headers", listener: (headers: MessageParser.Header[]) => void): this; removeListener(event: "close", listener: () => void): this; removeListener(event: "data", listener: (chunk: any) => void): this; removeListener(event: "end", listener: () => void): this; removeListener(event: "readable", listener: () => void): this; removeListener(event: "error", listener: (err: Error) => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; } export = MessageParser; nodemailer/lib/dkim/relaxed-body.d.ts000644 001751 001751 0000007344 15146137154021547 0ustar00runner000000 000000 1514613715415146137154/// import { Transform, TransformOptions } from "stream"; declare namespace RelaxedBody { interface Options extends TransformOptions { hashAlgo?: string; debug?: boolean; } } /** * Streams through a message body and calculates relaxed body hash */ declare class RelaxedBody extends Transform { constructor(options?: RelaxedBody.Options); addListener(event: "hash", listener: (digest: Buffer, debugBody: Buffer | false) => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: any) => void): this; addListener(event: "end", listener: () => void): this; addListener(event: "readable", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit(event: "hash", digest: Buffer, debugBody: Buffer | false): boolean; emit(event: "close"): boolean; emit(event: "data", chunk: any): boolean; emit(event: "end"): boolean; emit(event: "readable"): boolean; emit(event: "error", err: Error): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "hash", listener: (digest: Buffer, debugBody: Buffer | false) => void): this; on(event: "close", listener: () => void): this; on(event: "data", listener: (chunk: any) => void): this; on(event: "end", listener: () => void): this; on(event: "readable", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: "hash", listener: (digest: Buffer, debugBody: Buffer | false) => void): this; once(event: "close", listener: () => void): this; once(event: "data", listener: (chunk: any) => void): this; once(event: "end", listener: () => void): this; once(event: "readable", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener(event: "hash", listener: (digest: Buffer, debugBody: Buffer | false) => void): this; prependListener(event: "close", listener: () => void): this; prependListener(event: "data", listener: (chunk: any) => void): this; prependListener(event: "end", listener: () => void): this; prependListener(event: "readable", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: "hash", listener: (digest: Buffer, debugBody: Buffer | false) => void): this; prependOnceListener(event: "close", listener: () => void): this; prependOnceListener(event: "data", listener: (chunk: any) => void): this; prependOnceListener(event: "end", listener: () => void): this; prependOnceListener(event: "readable", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; removeListener(event: "hash", listener: (digest: Buffer, debugBody: Buffer | false) => void): this; removeListener(event: "close", listener: () => void): this; removeListener(event: "data", listener: (chunk: any) => void): this; removeListener(event: "end", listener: () => void): this; removeListener(event: "readable", listener: () => void): this; removeListener(event: "error", listener: (err: Error) => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; } export = RelaxedBody; nodemailer/lib/dkim/sign.d.ts000644 001751 001751 0000001017 15146137154020117 0ustar00runner000000 000000 1514613715415146137154import DKIM = require("."); import MessageParser = require("./message-parser"); /** Returns DKIM signature header line */ declare function relaxedHeaders( headers: MessageParser.Header[], hashAlgo: string, bodyHash: string, options?: DKIM.SingleKeyOptions, ): string; declare namespace relaxedHeaders { function relaxedHeaders( headers: MessageParser.Header[], hashAlgo: string, bodyHash: string, options?: DKIM.SingleKeyOptions, ): string; } export = relaxedHeaders; nodemailer/lib/fetch/cookies.d.ts000644 001751 001751 0000003072 15146137154020763 0ustar00runner000000 000000 1514613715415146137154type s = number; declare namespace Cookies { interface Cookie { name: string; value?: string | undefined; expires?: Date | undefined; path?: string | undefined; domain?: string | undefined; secure?: boolean | undefined; httponly?: boolean | undefined; } interface Options { sessionTimeout?: s | undefined; } } /** Creates a biskviit cookie jar for managing cookie values in memory */ declare class Cookies { options: Cookies.Options; cookies: Cookies.Cookie[]; constructor(options?: Cookies.Options); /** Stores a cookie string to the cookie storage */ set(cookieStr: string, url: string): boolean; /** Returns cookie string for the 'Cookie:' header. */ get(url: string): string; /** Lists all valied cookie objects for the specified URL */ list(url: string): Cookies.Cookie[]; /** Parses cookie string from the 'Set-Cookie:' header */ parse(cookieStr: string): Cookies.Cookie; /** Checks if a cookie object is valid for a specified URL */ match(cookie: Cookies.Cookie, url: string): boolean; /** Adds (or updates/removes if needed) a cookie object to the cookie storage */ add(cookie: Cookies.Cookie): boolean; /** Checks if two cookie objects are the same */ compare(a: Cookies.Cookie, b: Cookies.Cookie): boolean; /** Checks if a cookie is expired */ isExpired(cookie: Cookies.Cookie): boolean; /** Returns normalized cookie path for an URL path argument */ getPath(pathname: string): string; } export = Cookies; nodemailer/lib/fetch/index.d.ts000644 001751 001751 0000002100 15146137154020425 0ustar00runner000000 000000 1514613715415146137154/// type ms = number; import _Cookies = require("./cookies"); import * as http from "http"; import { Writable } from "stream"; import * as tls from "tls"; declare namespace fetch { type Cookies = _Cookies; interface WritableResponse extends Writable { statusCode: number; headers: http.IncomingHttpHeaders; } interface Options { fetchRes?: Writable | undefined; cookies?: Cookies | undefined; cookie?: string | undefined; redirects?: number | undefined; maxRedirects?: number | undefined; method?: string | undefined; headers?: { [key: string]: string } | undefined; userAgent?: string | undefined; body?: Buffer | string | { [key: string]: string } | undefined; contentType?: string | false | undefined; tls?: tls.TlsOptions | undefined; timeout?: ms | undefined; allowErrorResponse?: boolean | undefined; } } declare function fetch(url: string, options?: fetch.Options): fetch.WritableResponse; export = fetch; nodemailer/lib/json-transport/index.d.ts000644 001751 001751 0000002760 15146137154022353 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "events"; import { Transport, TransportOptions } from "../.."; import * as shared from "../shared"; import Mail = require("../mailer"); import MailMessage = require("../mailer/mail-message"); import MimeNode = require("../mime-node"); declare namespace JSONTransport { type MailOptions = Mail.Options; interface Options extends MailOptions, TransportOptions { jsonTransport: true; skipEncoding?: boolean | undefined; } interface SentMessageInfo { /** an envelope object {from:‘address’, to:[‘address’]} */ envelope: MimeNode.Envelope; /** the Message-ID header value */ messageId: string; /** JSON string */ message: string; accepted: Array; rejected: Array; pending: Array; response: string; } } declare class JSONTransport implements Transport { options: JSONTransport.Options; logger: shared.Logger; mailer: Mail; name: string; version: string; constructor(options: JSONTransport.Options); /** Compiles a mailcomposer message and forwards it to handler that sends it */ send( mail: MailMessage, callback: (err: Error | null, info: JSONTransport.SentMessageInfo) => void, ): void; } export = JSONTransport; nodemailer/lib/mail-composer/index.d.ts000644 001751 001751 0000001333 15146137154022112 0ustar00runner000000 000000 1514613715415146137154/// import { URL } from "url"; import Mail = require("../mailer"); import MimeNode = require("../mime-node"); /** Creates the object for composing a MimeNode instance out from the mail options */ declare class MailComposer { mail: Mail.Options; message: MimeNode | false; constructor(mail: Mail.Options); /** Builds MimeNode instance */ compile(): MimeNode; /** List all attachments. Resulting attachment objects can be used as input for MimeNode nodes */ getAttachments(findRelated: boolean): Mail.Attachment[]; /** List alternatives. Resulting objects can be used as input for MimeNode nodes */ getAlternatives(): Mail.Attachment[]; } export = MailComposer; nodemailer/lib/mailer/index.d.ts000644 001751 001751 0000034347 15146137154020627 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "events"; import { Socket } from "net"; import { Readable } from "stream"; import { Url } from "url"; import { Transport, TransportOptions } from "../.."; import * as shared from "../shared"; import DKIM = require("../dkim"); import MailMessage = require("./mail-message"); import MimeNode = require("../mime-node"); import SMTPConnection = require("../smtp-connection"); import XOAuth2 = require("../xoauth2"); declare namespace Mail { type Headers = | { [key: string]: string | string[] | { prepared: boolean; value: string } } | Array<{ key: string; value: string }>; type ListHeader = string | { url: string; comment: string }; interface ListHeaders { [key: string]: ListHeader | ListHeader[] | ListHeader[][]; } type TextEncoding = "quoted-printable" | "base64"; interface Address { name: string; address: string; } interface AttachmentLike { /** String, Buffer or a Stream contents for the attachment */ content?: string | Buffer | Readable | undefined; /** path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments) */ path?: string | Url | undefined; } interface Attachment extends AttachmentLike { /** filename to be reported as the name of the attached file, use of unicode is allowed. If you do not want to use a filename, set this value as false, otherwise a filename is generated automatically */ filename?: string | false | undefined; /** optional content id for using inline images in HTML message source. Using cid sets the default contentDisposition to 'inline' and moves the attachment into a multipart/related mime node, so use it only if you actually want to use this attachment as an embedded image */ cid?: string | undefined; /** If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, binary etc. Useful if you want to use binary attachments in a JSON formatted e-mail object */ encoding?: string | undefined; /** optional content type for the attachment, if not set will be derived from the filename property */ contentType?: string | undefined; /** optional transfer encoding for the attachment, if not set it will be derived from the contentType property. Example values: quoted-printable, base64. If it is unset then base64 encoding is used for the attachment. If it is set to false then previous default applies (base64 for most, 7bit for text). */ contentTransferEncoding?: "7bit" | "base64" | "quoted-printable" | false | undefined; /** optional content disposition type for the attachment, defaults to ‘attachment’ */ contentDisposition?: "attachment" | "inline" | undefined; /** is an object of additional headers */ headers?: Headers | undefined; /** an optional value that overrides entire node content in the mime message. If used then all other options set for this node are ignored. */ raw?: string | Buffer | Readable | AttachmentLike | undefined; } interface AmpAttachment extends AttachmentLike { /** is an alternative for content to load the AMP4EMAIL data from an URL */ href?: string | undefined; /** defines optional content encoding, eg. ‘base64’ or ‘hex’. This only applies if the content is a string. By default an unicode string is assumed. */ encoding?: string | undefined; /** optional content type for the attachment, if not set will be derived from the filename property */ contentType?: string | undefined; /** an optional value that overrides entire node content in the mime message. If used then all other options set for this node are ignored. */ raw?: string | Buffer | Readable | AttachmentLike | undefined; } interface IcalAttachment extends AttachmentLike { /** optional method, case insensitive, defaults to ‘publish’. Other possible values would be ‘request’, ‘reply’, ‘cancel’ or any other valid calendar method listed in RFC5546. This should match the METHOD: value in calendar event file. */ method?: string | undefined; /** optional filename, defaults to ‘invite.ics’ */ filename?: string | false | undefined; /** is an alternative for content to load the calendar data from an URL */ href?: string | undefined; /** defines optional content encoding, eg. ‘base64’ or ‘hex’. This only applies if the content is a string. By default an unicode string is assumed. */ encoding?: string | undefined; } interface Connection { connection: Socket; } interface Envelope { /** the first address gets used as MAIL FROM address in SMTP */ from?: string | undefined; /** addresses from this value get added to RCPT TO list */ to?: string | undefined; /** addresses from this value get added to RCPT TO list */ cc?: string | undefined; /** addresses from this value get added to RCPT TO list */ bcc?: string | undefined; } interface Options { /** The e-mail address of the sender. All e-mail addresses can be plain 'sender@server.com' or formatted 'Sender Name ' */ from?: string | Address | Array | undefined; /** An e-mail address that will appear on the Sender: field */ sender?: string | Address | undefined; /** Comma separated list or an array of recipients e-mail addresses that will appear on the To: field */ to?: string | Address | Array | undefined; /** Comma separated list or an array of recipients e-mail addresses that will appear on the Cc: field */ cc?: string | Address | Array | undefined; /** Comma separated list or an array of recipients e-mail addresses that will appear on the Bcc: field */ bcc?: string | Address | Array | undefined; /** Comma separated list or an array of e-mail addresses that will appear on the Reply-To: field */ replyTo?: string | Address | Array | undefined; /** The message-id this message is replying */ inReplyTo?: string | Address | undefined; /** Message-id list (an array or space separated string) */ references?: string | string[] | undefined; /** The subject of the e-mail */ subject?: string | undefined; /** The plaintext version of the message */ text?: string | Buffer | Readable | AttachmentLike | undefined; /** The HTML version of the message */ html?: string | Buffer | Readable | AttachmentLike | undefined; /** Apple Watch specific HTML version of the message, same usage as with text and html */ watchHtml?: string | Buffer | Readable | AttachmentLike | undefined; /** AMP4EMAIL specific HTML version of the message, same usage as with text and html. Make sure it is a full and valid AMP4EMAIL document, otherwise the displaying email client falls back to html and ignores the amp part */ amp?: string | Buffer | Readable | AmpAttachment | undefined; /** iCalendar event, same usage as with text and html. Event method attribute defaults to ‘PUBLISH’ or define it yourself: {method: 'REQUEST', content: iCalString}. This value is added as an additional alternative to html or text. Only utf-8 content is allowed */ icalEvent?: string | Buffer | Readable | IcalAttachment | undefined; /** An object or array of additional header fields */ headers?: Headers | undefined; /** An object where key names are converted into list headers. List key help becomes List-Help header etc. */ list?: ListHeaders | undefined; /** An array of attachment objects */ attachments?: Attachment[] | undefined; /** An array of alternative text contents (in addition to text and html parts) */ alternatives?: Attachment[] | undefined; /** optional SMTP envelope, if auto generated envelope is not suitable */ envelope?: Envelope | MimeNode.Envelope | undefined; /** optional Message-Id value, random value will be generated if not set */ messageId?: string | undefined; /** optional Date value, current UTC string will be used if not set */ date?: Date | string | undefined; /** optional transfer encoding for the textual parts */ encoding?: string | undefined; /** if set then overwrites entire message output with this value. The value is not parsed, so you should still set address headers or the envelope value for the message to work */ raw?: string | Buffer | Readable | AttachmentLike | undefined; /** set explicitly which encoding to use for text parts (quoted-printable or base64). If not set then encoding is detected from text content (mostly ascii means quoted-printable, otherwise base64) */ textEncoding?: TextEncoding | undefined; /** if set to true then fails with an error when a node tries to load content from URL */ disableUrlAccess?: boolean | undefined; /** if set to true then fails with an error when a node tries to load content from a file */ disableFileAccess?: boolean | undefined; /** is an object with DKIM options */ dkim?: DKIM.Options | undefined; /** method to normalize header keys for custom caseing */ normalizeHeaderKey?(key: string): string; priority?: "high" | "normal" | "low" | undefined; /** if set to true then converts data:images in the HTML content of message to embedded attachments */ attachDataUrls?: boolean | undefined; /** if set to false then removes x-mailer header, otherwise replaces the default x-mailer header value **/ xMailer?: false | string; } type PluginFunction = (mail: MailMessage, callback: (err?: Error | null) => void) => void; } /** Creates an object for exposing the Mail API */ declare class Mail extends EventEmitter { options: Mail.Options; meta: Map; dkim: DKIM; transporter: Transport; logger: shared.Logger; /** Usage: typeof transporter.MailMessage */ MailMessage: MailMessage; _defaults: DefaultTransportOptions; constructor(transporter: Transport, options?: TransportOptions, defaults?: DefaultTransportOptions); /** Closes all connections in the pool. If there is a message being sent, the connection is closed later */ close(): void; /** Returns true if there are free slots in the queue */ isIdle(): boolean; /** Verifies SMTP configuration */ verify(callback: (err: Error | null, success: true) => void): void; verify(): Promise; use(step: string, plugin: Mail.PluginFunction): this; /** Sends an email using the preselected transport object */ sendMail( mailOptions: Mail.Options & Partial, callback: (err: Error | null, info: T) => void, ): void; sendMail(mailOptions: Mail.Options, callback: (err: Error | null, info: T) => void): void; sendMail(mailOptions: Mail.Options & Partial): Promise; sendMail(mailOptions: Mail.Options): Promise; getVersionString(): string; /** Sets up proxy handler for a Nodemailer object */ setupProxy(proxyUrl: string): void; set( key: "oauth2_provision_cb", value: ( user: string, renew: boolean, callback: (err: Error | null, accessToken?: string, expires?: number) => void, ) => void, ): Map; set( key: | "proxy_handler_http" | "proxy_handler_https" | "proxy_handler_socks" | "proxy_handler_socks5" | "proxy_handler_socks4" | "proxy_handler_socks4a", value: ( proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions?: { connection: Socket }) => void, ) => void, ): Map; set(key: string, value: any): Map; get( key: "oauth2_provision_cb", ): ( user: string, renew: boolean, callback: (err: Error | null, accessToken: string, expires: number) => void, ) => void; get( key: | "proxy_handler_http" | "proxy_handler_https" | "proxy_handler_socks" | "proxy_handler_socks5" | "proxy_handler_socks4" | "proxy_handler_socks4a", ): ( proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions: { connection: Socket }) => void, ) => void; get(key: string): any; addListener(event: "error", listener: (err: Error) => void): this; addListener(event: "idle", listener: () => void): this; addListener(event: "token", listener: (token: XOAuth2.Token) => void): this; emit(event: "error", error: Error): boolean; emit(event: "idle"): boolean; emit(event: "token", token: XOAuth2.Token): boolean; on(event: "error", listener: (err: Error) => void): this; on(event: "idle", listener: () => void): this; on(event: "token", listener: (token: XOAuth2.Token) => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: "idle", listener: () => void): this; once(event: "token", listener: (token: XOAuth2.Token) => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependListener(event: "idle", listener: () => void): this; prependListener(event: "end", listener: (token: XOAuth2.Token) => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; prependOnceListener(event: "idle", listener: () => void): this; prependOnceListener(event: "end", listener: (token: XOAuth2.Token) => void): this; listeners(event: "error"): Array<(err: Error) => void>; listeners(event: "idle"): Array<() => void>; listeners(event: "end"): Array<(token: XOAuth2.Token) => void>; } export = Mail; nodemailer/lib/mailer/mail-message.d.ts000644 001751 001751 0000001351 15146137154022051 0ustar00runner000000 000000 1514613715415146137154/// import { Readable } from "stream"; import Mail = require("."); import MimeNode = require("../mime-node"); declare class MailMessage { mailer: Mail; data: Mail.Options; message: MimeNode; constructor(mailer: Mail, data: Mail.Options); resolveContent( data: object | any[], key: string | number, callback: (err: Error | null, value?: any) => any, ): Promise; resolveAll(callback: (err?: Error | null, data?: Mail.Options) => void): void; normalize(callback: (err?: Error | null, data?: Mail.Options) => void): void; setMailerHeader(): void; setPriorityHeaders(): void; setListHeaders(): void; } export = MailMessage; nodemailer/lib/mime-funcs/index.d.ts000644 001751 001751 0000006172 15146137154021414 0ustar00runner000000 000000 1514613715415146137154export interface HeaderValue { value: string; params?: { [key: string]: string } | undefined; } export interface ParsedHeaderValue extends HeaderValue { params: { [key: string]: string }; } export interface ParsedHeaderParam { key: string; value: string; } /** Checks if a value is plaintext string (uses only printable 7bit chars) */ export function isPlainText(value: string): boolean; /** * Checks if a multi line string containes lines longer than the selected value. * * Useful when detecting if a mail message needs any processing at all – * if only plaintext characters are used and lines are short, then there is * no need to encode the values in any way. If the value is plaintext but has * longer lines then allowed, then use format=flowed */ export function hasLongerLines(str: string, lineLength: number): boolean; /** Encodes a string or an Buffer to an UTF-8 MIME Word (rfc2047) */ export function encodeWord(data: Buffer | string, mimeWordEncoding?: "Q" | "B", maxLength?: number): string; /** Finds word sequences with non ascii text and converts these to mime words */ export function encodeWords(value: string, mimeWordEncoding?: "Q" | "B", maxLength?: number): string; /** * Joins parsed header value together as 'value; param1=value1; param2=value2' * PS: We are following RFC 822 for the list of special characters that we need to keep in quotes. * Refer: https://www.w3.org/Protocols/rfc1341/4_Content-Type.html */ export function buildHeaderValue(structured: HeaderValue): string; /** * Encodes a string or an Buffer to an UTF-8 Parameter Value Continuation encoding (rfc2231) * Useful for splitting long parameter values. * * For example * ``` * title="unicode string" * ``` * becomes * ``` * title*0*=utf-8''unicode * title*1*=%20string * ``` */ export function buildHeaderParam(key: string, data: Buffer | string, maxLength?: number): ParsedHeaderParam[]; /** * Parses a header value with key=value arguments into a structured * object. * * ``` * parseHeaderValue('content-type: text/plain; CHARSET='UTF-8') -> * { * 'value': 'text/plain', * 'params': { * 'charset': 'UTF-8' * } * } * ``` */ export function parseHeaderValue(str: string): ParsedHeaderValue; /** Returns file extension for a content type string. If no suitable extensions are found, 'bin' is used as the default extension */ export function detectExtension(mimeType: string): string; /** Returns content type for a file extension. If no suitable content types are found, 'application/octet-stream' is used as the default content type */ export function detectMimeType(extension: string): string; /** Folds long lines, useful for folding header lines (afterSpace=false) and flowed text (afterSpace=true) */ export function foldLines(str: string, lineLength?: number, afterSpace?: boolean): string; /** Splits a mime encoded string. Needed for dividing mime words into smaller chunks */ export function splitMimeEncodedString(str: string, maxlen?: number): string[]; export function encodeURICharComponent(chr: string): string; export function safeEncodeURIComponent(str: string): string; nodemailer/lib/mime-funcs/mime-types.d.ts000644 001751 001751 0000000205 15146137154022365 0ustar00runner000000 000000 1514613715415146137154export function detectMimeType(filename: string | false): string; export function detectExtension(mimeType: string | false): string; nodemailer/lib/mime-node/index.d.ts000644 001751 001751 0000016051 15146137154021220 0ustar00runner000000 000000 1514613715415146137154/// import { Readable, ReadableOptions, Transform } from "stream"; import Mail = require("../mailer"); declare namespace MimeNode { interface Addresses { from?: string[] | undefined; sender?: string[] | undefined; "reply-to"?: string[] | undefined; to?: string[] | undefined; cc?: string[] | undefined; bcc?: string[] | undefined; } interface Envelope { /** includes an address object or is set to false */ from: string | false; /** includes an array of address objects */ to: string[]; } interface Options { /** root node for this tree */ rootNode?: MimeNode | undefined; /** immediate parent for this node */ parentNode?: MimeNode | undefined; /** filename for an attachment node */ filename?: string | undefined; /** Hostname for default message-id values */ hostname?: string | undefined; /** shared part of the unique multipart boundary */ baseBoundary?: string | undefined; /** If true, do not exclude Bcc from the generated headers */ keepBcc?: boolean | undefined; /** * If set to 'win' then uses \r\n, * if 'linux' then \n. * If not set (or `raw` is used) then newlines are kept as is. */ newline?: string | undefined; /** either 'Q' (the default) or 'B' */ textEncoding?: "B" | "Q" | undefined; /** method to normalize header keys for custom caseing */ normalizeHeaderKey?(key: string): string; /** undocumented */ boundaryPrefix?: string | undefined; /** Undocumented */ disableFileAccess?: boolean | undefined; /** Undocumented */ disableUrlAccess?: boolean | undefined; } } /** * Creates a new mime tree node. Assumes 'multipart/*' as the content type * if it is a branch, anything else counts as leaf. If rootNode is missing from * the options, assumes this is the root. */ declare class MimeNode { constructor(contentType?: string, options?: MimeNode.Options); /** Creates and appends a child node.Arguments provided are passed to MimeNode constructor */ createChild(contentType: string, options?: MimeNode.Options): MimeNode; /** Appends an existing node to the mime tree. Removes the node from an existing tree if needed */ appendChild(childNode: MimeNode): MimeNode; /** Replaces current node with another node */ replace(node: MimeNode): MimeNode; /** Removes current node from the mime tree */ remove(): this; /** * Sets a header value. If the value for selected key exists, it is overwritten. * You can set multiple values as well by using [{key:'', value:''}] or * {key: 'value'} as the first argument. */ setHeader(key: string, value: string | string[]): this; setHeader(headers: { [key: string]: string } | Array<{ key: string; value: string }>): this; /** * Adds a header value. If the value for selected key exists, the value is appended * as a new field and old one is not touched. * You can set multiple values as well by using [{key:'', value:''}] or * {key: 'value'} as the first argument. */ addHeader(key: string, value: string): this; addHeader(headers: { [key: string]: string } | Array<{ key: string; value: string }>): this; /** Retrieves the first mathcing value of a selected key */ getHeader(key: string): string; /** * Sets body content for current node. If the value is a string, charset is added automatically * to Content-Type (if it is text/*). If the value is a Buffer, you need to specify * the charset yourself */ setContent(content: string | Buffer | Readable): this; /** Generate the message and return it with a callback or promise */ build(callback: (err: Error | null, buf: Buffer) => void): void; build(): Promise; getTransferEncoding(): string; /** Builds the header block for the mime node. Append \r\n\r\n before writing the content */ buildHeaders(): string; /** * Streams the rfc2822 message from the current node. If this is a root node, * mandatory header fields are set if missing (Date, Message-Id, MIME-Version) */ createReadStream(options?: ReadableOptions): Readable; /** * Appends a transform stream object to the transforms list. Final output * is passed through this stream before exposing */ transform(transform: Transform): void; /** * Appends a post process function. The functon is run after transforms and * uses the following syntax * * processFunc(input) -> outputStream */ processFunc(processFunc: (outputStream: Readable) => Readable): void; stream(outputStream: Readable, options: ReadableOptions, done: (err?: Error | null) => void): void; /** Sets envelope to be used instead of the generated one */ setEnvelope(envelope: Mail.Envelope): this; /** Generates and returns an object with parsed address fields */ getAddresses(): MimeNode.Addresses; /** Generates and returns SMTP envelope with the sender address and a list of recipients addresses */ getEnvelope(): MimeNode.Envelope; /** Returns Message-Id value. If it does not exist, then creates one */ messageId(): string; /** Sets pregenerated content that will be used as the output of this node */ setRaw(raw: string | Buffer | Readable): this; /** shared part of the unique multipart boundary */ baseBoundary: string; /** a multipart boundary value */ boundary?: string | false | undefined; /** Undocumented */ boundaryPrefix: string; /* An array for possible child nodes */ childNodes: MimeNode[]; /** body content for current node */ content?: string | Buffer | Readable | undefined; /** Undocumented */ contentType?: string | undefined; /** * If date headers is missing and current node is the root, this value is used instead */ date: Date; /** Undocumented */ disableFileAccess: boolean; /** Undocumented */ disableUrlAccess: boolean; /** filename for an attachment node */ filename?: string | undefined; /** Hostname for default message-id values */ hostname?: string | undefined; /** If true, do not exclude Bcc from the generated headers */ keepBcc: boolean; /** Undocumented */ multipart?: boolean | undefined; /** * If set to 'win' then uses \r\n, * if 'linux' then \n. * If not set (or `raw` is used) then newlines are kept as is. */ newline?: string | undefined; /** Undocumented */ nodeCounter: number; /** method to normalize header keys for custom caseing */ normalizeHeaderKey?: ((key: string) => string) | undefined; /* Immediate parent for this node (or undefined if not set) */ parentNode?: MimeNode | undefined; /** root node for this tree */ rootNode: MimeNode; /** either 'Q' (the default) or 'B' */ textEncoding: "B" | "Q" | ""; } export = MimeNode; nodemailer/lib/mime-node/last-newline.d.ts000644 001751 001751 0000000243 15146137154022507 0ustar00runner000000 000000 1514613715415146137154/// import { Transform } from "stream"; declare class LastNewline extends Transform { lastByte: boolean; } export = LastNewline; nodemailer/lib/qp/index.d.ts000644 001751 001751 0000001255 15146137154017766 0ustar00runner000000 000000 1514613715415146137154/// import { Transform, TransformOptions } from "stream"; /** Encodes a Buffer into a Quoted-Printable encoded string */ export function encode(buffer: Buffer | string): string; /** Adds soft line breaks to a Quoted-Printable string */ export function wrap(str: string, lineLength?: number): string; export interface EncoderOptions extends TransformOptions { lineLength?: number | false | undefined; } /** Creates a transform stream for encoding data to Quoted-Printable encoding */ export class Encoder extends Transform { options: EncoderOptions; inputBytes: number; outputBytes: number; constructor(options?: EncoderOptions); } nodemailer/lib/sendmail-transport/index.d.ts000644 001751 001751 0000003704 15146137154023175 0ustar00runner000000 000000 1514613715415146137154/// import { Transport, TransportOptions } from "../.."; import * as shared from "../shared"; import Mail = require("../mailer"); import MailMessage = require("../mailer/mail-message"); import MimeNode = require("../mime-node"); declare namespace SendmailTransport { type MailOptions = Mail.Options; interface Options extends MailOptions, TransportOptions { sendmail: true; /** path to the sendmail command (defaults to ‘sendmail’) */ path?: string | undefined; /** either ‘windows’ or ‘unix’ (default). Forces all newlines in the output to either use Windows syntax or Unix syntax */ newline?: string | undefined; /** an optional array of command line options to pass to the sendmail command (ie. ["-f", "foo@blurdybloop.com"]). This overrides all default arguments except for ’-i’ and recipient list so you need to make sure you have all required arguments set (ie. the ‘-f’ flag). */ args?: string[] | undefined; } interface SentMessageInfo { envelope: MimeNode.Envelope; messageId: string; response: string; accepted: Array; rejected: Array; pending: Array; } } declare class SendmailTransport implements Transport { options: SendmailTransport.Options; logger: shared.Logger; mailer: Mail; name: string; version: string; path: string; args: string[] | false; winbreak: boolean; constructor(options: SendmailTransport.Options); /** Compiles a mailcomposer message and forwards it to handler that sends it */ send( mail: MailMessage, callback: (err: Error | null, info: SendmailTransport.SentMessageInfo) => void, ): void; } export = SendmailTransport; nodemailer/lib/sendmail-transport/le-unix.d.ts000644 001751 001751 0000000201 15146137154023434 0ustar00runner000000 000000 1514613715415146137154/// import { Transform } from "stream"; declare class LeUnix extends Transform {} export = LeUnix; nodemailer/lib/sendmail-transport/le-windows.d.ts000644 001751 001751 0000000207 15146137154024151 0ustar00runner000000 000000 1514613715415146137154/// import { Transform } from "stream"; declare class LeWindows extends Transform {} export = LeWindows; nodemailer/lib/ses-transport/index.d.ts000644 001751 001751 0000007555 15146137154022203 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "node:events"; import { Transport, TransportOptions } from "../.."; import * as shared from "../shared"; import Mail = require("../mailer"); import MailMessage = require("../mailer/mail-message"); import MimeNode = require("../mime-node"); declare namespace SESTransport { /** * Minimal structural shape of SESv2 SendEmail input. * This is intentionally structural so @types/nodemailer does not require * installing @aws-sdk/client-sesv2. * * If you want the full, exact type, install @aws-sdk/client-sesv2 in your * app and use its types directly in your own code. */ interface SendEmailRequestLike { FromEmailAddress?: string; Destination?: { ToAddresses?: string[]; CcAddresses?: string[]; BccAddresses?: string[]; }; ReplyToAddresses?: string[]; Content?: unknown; EmailTags?: Array<{ Name?: string; Value?: string }>; ConfigurationSetName?: string; ListManagementOptions?: unknown; FeedbackForwardingEmailAddress?: string; // Allow extra fields without forcing the SDK type package [key: string]: unknown; } /** Structural type matching SESv2Client from @aws-sdk/client-sesv2 */ interface SESv2ClientLike { send(command: unknown, options?: unknown): Promise<{ MessageId?: string }>; config?: { region?: string | (() => Promise); }; } /** * Constructor type for SendEmailCommand from @aws-sdk/client-sesv2. * The real type is: new(input: SendEmailCommandInput) => SendEmailCommand * Contravariance prevents typing this more strictly without pulling in aws-sdk as a dependency. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any type SendEmailCommandConstructorLike = new(input: any) => unknown; interface MailOptions extends Mail.Options { /** Options passed to AWS SESv2 SendEmailCommand */ ses?: MailSesOptions | undefined; } // Keep it as an interface for backward-compatibility // eslint-disable-next-line @typescript-eslint/no-empty-interface interface MailSesOptions extends Partial {} interface Options extends MailOptions, TransportOptions { /** An object containing an instantiated SESv2Client and the SendEmailCommand class */ SES: { sesClient: SESv2ClientLike; SendEmailCommand: SendEmailCommandConstructorLike; }; } interface SentMessageInfo { /** an envelope object {from:'address', to:['address']} */ envelope: MimeNode.Envelope; /** the Message-ID header value. This value is derived from the response of SES API, so it differs from the Message-ID values used in logging. */ messageId: string; response: string; accepted: Array; rejected: Array; pending: Array; raw: Buffer; } } declare class SESTransport extends EventEmitter implements Transport { options: SESTransport.Options; logger: shared.Logger; mailer: Mail; name: string; version: string; ses: SESTransport.Options["SES"]; constructor(options: SESTransport.Options); /** Undocumented */ getRegion( callback: (err: Error | null, region: string | undefined) => void, ): void; /** Schedules a sending of a message */ send( mail: MailMessage, callback: (err: Error | null, info: SESTransport.SentMessageInfo) => void, ): void; /** Verifies SES configuration */ verify(callback: (err: Error | null, success: true) => void): void; verify(): Promise; } export = SESTransport; nodemailer/lib/shared/index.d.ts000644 001751 001751 0000004435 15146137154020617 0ustar00runner000000 000000 1514613715415146137154/// import SMTPConnection = require("../smtp-connection"); import stream = require("stream"); export type LoggerLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal"; export interface Logger { level(level: LoggerLevel): void; trace(...params: any[]): void; debug(...params: any[]): void; info(...params: any[]): void; warn(...params: any[]): void; error(...params: any[]): void; fatal(...params: any[]): void; } export interface ResolveHostnameOptions { host?: string | undefined; servername?: string | false | undefined; } export interface ResolveHostnameValue { host: string; servername: string | false; _cached?: true | undefined; } export function resolveHostname( options: ResolveHostnameOptions | null | undefined, callback: (err: Error | null, value: ResolveHostnameValue) => void, ): void; /** Parses connection url to a structured configuration object */ export function parseConnectionUrl(url: string): SMTPConnection.Options; /** Returns a bunyan-compatible logger interface. Uses either provided logger or creates a default console logger */ export function getLogger(options?: { [key: string]: any }, defaults?: { [key: string]: any }): Logger; /** Wrapper for creating a callback than either resolves or rejects a promise based on input */ export function callbackPromise(resolve: (...args: any[]) => void, reject: (err: Error) => void): () => void; /** * Resolves a String or a Buffer value for content value. Useful if the value * is a Stream or a file or an URL. If the value is a Stream, overwrites * the stream object with the resolved value (you can't stream a value twice). * * This is useful when you want to create a plugin that needs a content value, * for example the `html` or `text` value as a String or a Buffer but not as * a file path or an URL. */ export function resolveContent( data: object | any[], key: string | number, callback: (err: Error | null, value: Buffer | string) => void, ): void; export function resolveContent(data: object | any[], key: string | number): Promise; /** Copies properties from source objects to target objects */ export function assign(target: object, ...sources: object[]): object; export function encodeXText(str: string): string; nodemailer/lib/smtp-connection/data-stream.d.ts000644 001751 001751 0000000453 15146137154023560 0ustar00runner000000 000000 1514613715415146137154/// import { Transform } from "stream"; /** * Escapes dots in the beginning of lines. Ends the stream with . * Also makes sure that only sequences are used for linebreaks */ declare class DataStream extends Transform {} export = DataStream; nodemailer/lib/smtp-connection/http-proxy-client.d.ts000644 001751 001751 0000000572 15146137154024772 0ustar00runner000000 000000 1514613715415146137154/// import { Socket } from "net"; import { TLSSocket } from "tls"; /** * Establishes proxied connection to destinationPort */ declare function httpProxyClient( proxyUrl: string, destinationPort: number, destinationHost: string, callback: (err: Error | null, socket: TLSSocket | Socket) => void, ): void; export = httpProxyClient; nodemailer/lib/smtp-connection/index.d.ts000644 001751 001751 0000026353 15146137154022474 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "events"; import * as net from "net"; import { Readable } from "stream"; import * as tls from "tls"; import * as shared from "../shared"; import MimeNode = require("../mime-node"); import XOAuth2 = require("../xoauth2"); type ms = number; declare namespace SMTPConnection { interface Credentials { /** the username */ user: string; /** then password */ pass: string; } type OAuth2 = XOAuth2.Options; interface AuthenticationTypeCustom extends Credentials { /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */ type: "custom" | "Custom" | "CUSTOM"; method: string; } interface AuthenticationTypeLogin extends Credentials { /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */ type?: "login" | "Login" | "LOGIN" | undefined; } interface AuthenticationTypeOAuth2 extends OAuth2 { /** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ or ‘custom’ */ type?: "oauth2" | "OAuth2" | "OAUTH2" | undefined; } type AuthenticationType = AuthenticationTypeCustom | AuthenticationTypeLogin | AuthenticationTypeOAuth2; interface AuthenticationCredentials { /** normal authentication object */ credentials: Credentials; } interface AuthenticationOAuth2 { /** if set then forces smtp-connection to use XOAuth2 for authentication */ oauth2: OAuth2; } interface CustomAuthenticationResponse { command: string; response: string; status: number; text: string; code?: number | undefined; } interface CustomAuthenticationContext { auth: AuthenticationCredentials; authMethod: string; extensions: string[]; authMethods: string[]; maxAllowedSize: number | false; sendCommand(cmd: string): Promise; sendCommand(cmd: string, done: (err: Error | null, data: CustomAuthenticationResponse) => void): void; resolve(): unknown; reject(err: Error | string): unknown; } interface CustomAuthenticationHandlers { [method: string]: (ctx: CustomAuthenticationContext) => Promise | unknown; } type DSNOption = "NEVER" | "SUCCESS" | "FAILURE" | "DELAY"; interface DSNOptions { /** return either the full message ‘FULL’ or only headers ‘HDRS’ */ ret?: "Full" | "HDRS" | undefined; /** sender’s ‘envelope identifier’ for tracking */ envid?: string | undefined; /** when to send a DSN. Multiple options are OK - array or comma delimited. NEVER must appear by itself. */ notify?: DSNOption | DSNOption[] | undefined; /** original recipient */ orcpt?: string | undefined; } interface Envelope { /** includes an address object or is set to false */ from: string | false; /** the recipient address or an array of addresses */ to: string | string[]; /** an optional value of the predicted size of the message in bytes. This value is used if the server supports the SIZE extension (RFC1870) */ size?: number | undefined; /** if true then inform the server that this message might contain bytes outside 7bit ascii range */ use8BitMime?: boolean | undefined; /** the dsn options */ dsn?: DSNOptions | undefined; } interface SMTPError extends NodeJS.ErrnoException { /** string code identifying the error, for example ‘EAUTH’ is returned when authentication */ code?: string | undefined; /** the last response received from the server (if the error is caused by an error response from the server) */ response?: string | undefined; /** the numeric response code of the response string (if available) */ responseCode?: number | undefined; /** command which provoked an error */ command?: string | undefined; } interface SentMessageInfo { /** an array of accepted recipient addresses. Normally this array should contain at least one address except when in LMTP mode. In this case the message itself might have succeeded but all recipients were rejected after sending the message. */ accepted: string[]; /** an array of rejected recipient addresses. This array includes both the addresses that were rejected before sending the message and addresses rejected after sending it if using LMTP */ rejected: string[]; /** if some recipients were rejected then this property holds an array of error objects for the rejected recipients */ rejectedErrors?: SMTPError[] | undefined; /** the last response received from the server */ response: string; /** how long was envelope prepared */ envelopeTime: number; /** how long was send stream prepared */ messageTime: number; /** how many bytes were streamed */ messageSize: number; } interface Options { /** the hostname or IP address to connect to (defaults to ‘localhost’) */ host?: string | undefined; /** the port to connect to (defaults to 25 or 465) */ port?: number | undefined; /** defines authentication data */ auth?: AuthenticationType | undefined; /** defines if the connection should use SSL (if true) or not (if false) */ secure?: boolean | undefined; /** indicates that the provided socket has already been upgraded to TLS (if true) */ secured?: boolean | undefined; /** turns off STARTTLS support if true */ ignoreTLS?: boolean | undefined; /** forces the client to use STARTTLS. Returns an error if upgrading the connection is not possible or fails. */ requireTLS?: boolean | undefined; /** tries to use STARTTLS and continues normally if it fails */ opportunisticTLS?: boolean | undefined; /** optional hostname of the client, used for identifying to the server */ name?: string | undefined; /** the local interface to bind to for network connections */ localAddress?: string | undefined; /** how many milliseconds to wait for the connection to establish */ connectionTimeout?: ms | undefined; /** how many milliseconds to wait for the greeting after connection is established */ greetingTimeout?: ms | undefined; /** how many milliseconds of inactivity to allow */ socketTimeout?: ms | undefined; /** how many milliseconds to wait for the DNS requests to be resolved */ dnsTimeout?: ms | undefined; /** optional bunyan compatible logger instance. If set to true then logs to console. If value is not set or is false then nothing is logged */ logger?: shared.Logger | boolean | undefined; /** if set to true, then logs SMTP traffic without message content */ transactionLog?: boolean | undefined; /** if set to true, then logs SMTP traffic and message content, otherwise logs only transaction events */ debug?: boolean | undefined; /** defines preferred authentication method, e.g. ‘PLAIN’ */ authMethod?: string | undefined; /** defines additional options to be passed to the socket constructor, e.g. {rejectUnauthorized: true} */ tls?: tls.ConnectionOptions | undefined; /** initialized socket to use instead of creating a new one */ socket?: net.Socket | undefined; /** connected socket to use instead of creating and connecting a new one. If secure option is true, then socket is upgraded from plaintext to ciphertext */ connection?: net.Socket | undefined; customAuth?: CustomAuthenticationHandlers | undefined; /** if true, uses LMTP instead of SMTP protocol */ lmtp?: boolean | undefined; } } declare class SMTPConnection extends EventEmitter { options: SMTPConnection.Options; logger: shared.Logger; id: string; stage: "init" | "connected"; secureConnection: boolean; alreadySecured: boolean; port: number; host: string; name: string; /** Expose version nr, just for the reference */ version: string; /** If true, then the user is authenticated */ authenticated: boolean; /** If set to true, this instance is no longer active */ destroyed: boolean; /** Defines if the current connection is secure or not. If not, STARTTLS can be used if available */ secure: boolean; lastServerResponse: string | false; /** The socket connecting to the server */ _socket: net.Socket; constructor(options?: SMTPConnection.Options); /** Creates a connection to a SMTP server and sets up connection listener */ connect(callback: (err?: SMTPConnection.SMTPError) => void): void; /** Sends QUIT */ quit(): void; /** Closes the connection to the server */ close(): void; /** Authenticate user */ login( auth: | SMTPConnection.AuthenticationCredentials | SMTPConnection.AuthenticationOAuth2 | SMTPConnection.Credentials, callback: (err?: SMTPConnection.SMTPError) => void, ): void; /** Sends a message */ send( envelope: SMTPConnection.Envelope, message: string | Buffer | Readable, callback: (err: SMTPConnection.SMTPError | null, info: SMTPConnection.SentMessageInfo) => void, ): void; /** Resets connection state */ reset(callback: (err?: SMTPConnection.SMTPError) => void): void; addListener(event: "connect" | "end", listener: () => void): this; addListener(event: "error", listener: (err: SMTPConnection.SMTPError) => void): this; emit(event: "connect" | "end"): boolean; emit(event: "error", error: Error): boolean; listenerCount(event: "connect" | "end" | "error"): number; listeners(event: "connect" | "end"): Array<() => void>; listeners(event: "error"): Array<(err: SMTPConnection.SMTPError) => void>; off(event: "connect" | "end", listener: () => void): this; off(event: "error", listener: (err: SMTPConnection.SMTPError) => void): this; on(event: "connect" | "end", listener: () => void): this; on(event: "error", listener: (err: SMTPConnection.SMTPError) => void): this; once(event: "connect" | "end", listener: () => void): this; once(event: "error", listener: (err: SMTPConnection.SMTPError) => void): this; prependListener(event: "connect" | "end", listener: () => void): this; prependListener(event: "error", listener: (err: SMTPConnection.SMTPError) => void): this; prependOnceListener(event: "connect" | "end", listener: () => void): this; prependOnceListener(event: "error", listener: (err: SMTPConnection.SMTPError) => void): this; rawListeners(event: "connect" | "end"): Array<() => void>; rawListeners(event: "error"): Array<(err: SMTPConnection.SMTPError) => void>; removeAllListener(event: "connect" | "end" | "error"): this; removeListener(event: "connect" | "end", listener: () => void): this; removeListener(event: "error", listener: (err: SMTPConnection.SMTPError) => void): this; } export = SMTPConnection; nodemailer/lib/smtp-pool/index.d.ts000644 001751 001751 0000007331 15146137154021301 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "events"; import { Transport, TransportOptions } from "../.."; import * as shared from "../shared"; import Mail = require("../mailer"); import MailMessage = require("../mailer/mail-message"); import MimeNode = require("../mime-node"); import SMTPConnection = require("../smtp-connection"); declare namespace SMTPPool { interface MailOptions extends Mail.Options { auth?: SMTPConnection.AuthenticationType | undefined; dsn?: SMTPConnection.DSNOptions | undefined; } interface Options extends MailOptions, TransportOptions, SMTPConnection.Options { /** set to true to use pooled connections (defaults to false) instead of creating a new connection for every email */ pool: true; service?: string | undefined; getSocket?(options: Options, callback: (err: Error | null, socketOptions: any) => void): void; // TODO http.ClientRequest? url?: string | undefined; /** the count of maximum simultaneous connections to make against the SMTP server (defaults to 5) */ maxConnections?: number | undefined; /** limits the message count to be sent using a single connection (defaults to 100). After maxMessages is reached the connection is dropped and a new one is created for the following messages */ maxMessages?: number | undefined; /** defines the time measuring period in milliseconds (defaults to 1000, ie. to 1 second) for rate limiting */ rateDelta?: number | undefined; /** limits the message count to be sent in rateDelta time. Once rateLimit is reached, sending is paused until the end of the measuring period. This limit is shared between connections, so if one connection uses up the limit, then other connections are paused as well. If rateLimit is not set then sending rate is not limited */ rateLimit?: number | undefined; } interface SentMessageInfo extends SMTPConnection.SentMessageInfo { /** includes the envelope object for the message */ envelope: MimeNode.Envelope; /** most transports should return the final Message-Id value used with this property */ messageId: string; } } /** * Creates a SMTP pool transport object for Nodemailer */ declare class SMTPPool extends EventEmitter implements Transport { options: SMTPPool.Options; mailer: Mail; logger: shared.Logger; name: string; version: string; idling: boolean; constructor(options?: SMTPPool.Options | string); /** Placeholder function for creating proxy sockets. This method immediatelly returns without a socket */ getSocket(options: SMTPPool.Options, callback: (err: Error | null, socketOptions: any) => void): void; /** Sends an e-mail using the selected settings */ send( mail: MailMessage, callback: (err: Error | null, info: SMTPPool.SentMessageInfo) => void, ): void; /** Closes all connections in the pool. If there is a message being sent, the connection is closed later */ close(): void; /** Returns true if there are free slots in the queue */ isIdle(): boolean; /** Verifies SMTP configuration */ verify(callback: (err: Error | null, success: true) => void): void; verify(): Promise; addListener(event: "idle", listener: () => void): this; emit(event: "idle"): boolean; on(event: "idle", listener: () => void): this; once(event: "idle", listener: () => void): this; prependListener(event: "idle", listener: () => void): this; prependOnceListener(event: "idle", listener: () => void): this; listeners(event: "idle"): Array<() => void>; } export = SMTPPool; nodemailer/lib/smtp-pool/pool-resource.d.ts000644 001751 001751 0000005212 15146137154022764 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "events"; import MailMessage = require("../mailer/mail-message"); import * as shared from "../shared"; import SMTPPool = require("."); /** * Creates an element for the pool */ declare class PoolResource extends EventEmitter { pool: SMTPPool; options: SMTPPool.Options; logger: shared.Logger; messages: number; available: boolean; constructor(pool: SMTPPool); /** Initiates a connection to the SMTP server */ connect(callback: (err: Error | null, established: boolean) => void): void; /** Sends an e-mail to be sent using the selected settings */ send(mail: MailMessage, callback: (err: Error | null, info: SMTPPool.SentMessageInfo) => void): void; /** Closes the connection */ close(): void; addListener(event: "available", listener: () => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; emit(event: "available"): boolean; emit(event: "close"): boolean; emit(event: "error", err: Error): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: "available", listener: () => void): this; on(event: "close", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; once(event: "available", listener: () => void): this; once(event: "close", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; prependListener(event: "available", listener: () => void): this; prependListener(event: "close", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; prependOnceListener(event: "available", listener: () => void): this; prependOnceListener(event: "close", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; removeListener(event: "available", listener: () => void): this; removeListener(event: "close", listener: () => void): this; removeListener(event: "error", listener: (err: Error) => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; } export = PoolResource; nodemailer/lib/smtp-transport/index.d.ts000644 001751 001751 0000007526 15146137154022372 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "events"; import stream = require("stream"); import { Transport, TransportOptions } from "../.."; import * as shared from "../shared"; import Mail = require("../mailer"); import MailMessage = require("../mailer/mail-message"); import MimeNode = require("../mime-node"); import SMTPConnection = require("../smtp-connection"); import XOAuth2 = require("../xoauth2"); declare namespace SMTPTransport { interface AuthenticationTypeCustom extends SMTPConnection.Credentials { type: "CUSTOM"; method: string; } interface AuthenticationTypeLogin { type: "LOGIN"; user: string; credentials: SMTPConnection.Credentials; method: string | false; } interface AuthenticationTypeOAuth2 { type: "OAUTH2"; user: string; oauth2: XOAuth2; method: "XOAUTH2"; } type AuthenticationType = AuthenticationTypeLogin | AuthenticationTypeOAuth2; interface MailOptions extends Mail.Options { auth?: SMTPConnection.AuthenticationType | undefined; dsn?: SMTPConnection.DSNOptions | undefined; } interface Options extends MailOptions, TransportOptions, SMTPConnection.Options { service?: string | undefined; getSocket?(options: Options, callback: (err: Error | null, socketOptions: any) => void): void; // TODO http.ClientRequest? url?: string | undefined; } interface SentMessageInfo { /** includes the envelope object for the message */ envelope: MimeNode.Envelope; /** most transports should return the final Message-Id value used with this property */ messageId: string; accepted: Array; rejected: Array; pending: Array; response: string; } } declare class SMTPTransport extends EventEmitter implements Transport { options: SMTPTransport.Options; mailer: Mail; logger: shared.Logger; name: string; version: string; auth: SMTPTransport.AuthenticationType; constructor(options: SMTPTransport.Options | string); /** Placeholder function for creating proxy sockets. This method immediatelly returns without a socket */ getSocket(options: SMTPTransport.Options, callback: (err: Error | null, socketOptions: object) => void): void; getAuth( authOpts: SMTPConnection.AuthenticationTypeLogin | SMTPConnection.AuthenticationTypeOAuth2, ): SMTPTransport.AuthenticationType; /** Sends an e-mail using the selected settings */ send( mail: MailMessage, callback: (err: Error | null, info: SMTPTransport.SentMessageInfo) => void, ): void; /** Verifies SMTP configuration */ verify(callback: (err: Error | null, success: true) => void): void; verify(): Promise; /** Releases resources */ close(): void; addListener(event: "close", listener: () => void): this; addListener(event: "error", listener: (err: Error) => void): this; emit(event: "close"): boolean; emit(event: "error", error: Error): boolean; on(event: "close", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; once(event: "close", listener: () => void): this; once(event: "error", listener: (err: Error) => void): this; prependListener(event: "close", listener: () => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependOnceListener(event: "close", listener: () => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; listeners(event: "close"): Array<() => void>; listeners(event: "error"): Array<(err: Error) => void>; } export = SMTPTransport; nodemailer/lib/stream-transport/index.d.ts000644 001751 001751 0000003612 15146137154022672 0ustar00runner000000 000000 1514613715415146137154/// import { EventEmitter } from "events"; import { Readable } from "stream"; import { Transport, TransportOptions } from "../.."; import * as shared from "../shared"; import Mail = require("../mailer"); import MailMessage = require("../mailer/mail-message"); import MimeNode = require("../mime-node"); declare namespace StreamTransport { type MailOptions = Mail.Options; interface Options extends MailOptions, TransportOptions { streamTransport: true; /** if true, then returns the message as a Buffer object instead of a stream */ buffer?: boolean | undefined; /** either ‘windows’ or ‘unix’ (default). Forces all newlines in the output to either use Windows syntax or Unix syntax */ newline?: string | undefined; } interface SentMessageInfo { /** an envelope object {from:‘address’, to:[‘address’]} */ envelope: MimeNode.Envelope; /** the Message-ID header value */ messageId: string; /** either stream (default) of buffer depending on the options */ message: Buffer | Readable; accepted: Array; rejected: Array; pending: Array; response: string; } } declare class StreamTransport implements Transport { options: StreamTransport.Options; logger: shared.Logger; mailer: Mail; name: string; version: string; winbreak: boolean; constructor(options: StreamTransport.Options); /** Compiles a mailcomposer message and forwards it to handler that sends it */ send( mail: MailMessage, callback: (err: Error | null, info: StreamTransport.SentMessageInfo) => void, ): void; } export = StreamTransport; nodemailer/lib/well-known/index.d.ts000644 001751 001751 0000000460 15146137154021440 0ustar00runner000000 000000 1514613715415146137154import SMTPConnection = require("../smtp-connection"); /** Resolves SMTP config for given key. Key can be a name (like 'Gmail'), alias (like 'Google Mail') or an email address (like 'test@googlemail.com'). */ declare function wellKnown(key: string): SMTPConnection.Options | false; export = wellKnown; nodemailer/lib/xoauth2/index.d.ts000644 001751 001751 0000010237 15146137154020740 0ustar00runner000000 000000 1514613715415146137154/// import * as http from "http"; import { Readable, Stream } from "stream"; import * as shared from "../shared"; type ms = number; type s = number; declare namespace XOAuth2 { interface Options { /** User e-mail address */ user?: string | undefined; /** Client ID value */ clientId?: string | undefined; /** Client secret value */ clientSecret?: string | undefined; /** Refresh token for an user */ refreshToken?: string | undefined; /** Endpoint for token generation, defaults to 'https://accounts.google.com/o/oauth2/token' */ accessUrl?: string | undefined; /** An existing valid accessToken */ accessToken?: string | undefined; /** Private key for JSW */ privateKey?: string | { key: string; passphrase: string } | undefined; /** Optional Access Token expire time in ms */ expires?: ms | undefined; /** Optional TTL for Access Token in seconds */ timeout?: s | undefined; /** Function to run when a new access token is required */ provisionCallback?( user: string, renew: boolean, callback: (err: Error | null, accessToken: string, expires: number) => void, ): void; serviceClient?: string | undefined; } interface Token { user: string; accessToken: string; expires: number; } interface RequestParams { customHeaders?: http.OutgoingHttpHeaders | undefined; } } declare class XOAuth2 extends Stream { options: XOAuth2.Options; logger: shared.Logger; accessToken: string | false; expires: number; constructor(options?: XOAuth2.Options, logger?: shared.Logger); /** Returns or generates (if previous has expired) a XOAuth2 token */ getToken(renew: boolean, callback: (err: Error | null, accessToken: string) => void): void; /** Updates token values */ updateToken(accessToken: string, timeout: s): XOAuth2.Token; /** Generates a new XOAuth2 token with the credentials provided at initialization */ generateToken(callback: (err: Error | null, accessToken: string) => void): void; /** Converts an access_token and user id into a base64 encoded XOAuth2 token */ buildXOAuth2Token(accessToken: string): string; /** * Custom POST request handler. * This is only needed to keep paths short in Windows – usually this module * is a dependency of a dependency and if it tries to require something * like the request module the paths get way too long to handle for Windows. * As we do only a simple POST request we do not actually require complicated * logic support (no redirects, no nothing) anyway. */ postRequest( url: string, payload: string | Buffer | Readable | { [key: string]: string }, params: XOAuth2.RequestParams, callback: (err: Error | null, buf: Buffer) => void, ): void; /** Encodes a buffer or a string into Base64url format */ toBase64URL(data: Buffer | string): string; /** Creates a JSON Web Token signed with RS256 (SHA256 + RSA) */ jwtSignRS256(payload: object): string; addListener(event: "error", listener: (err: Error) => void): this; addListener(event: "token", listener: (token: XOAuth2.Token) => void): this; emit(event: "error", error: Error): boolean; emit(event: "token", token: XOAuth2.Token): boolean; on(event: "error", listener: (err: Error) => void): this; on(event: "token", listener: (token: XOAuth2.Token) => void): this; once(event: "error", listener: (err: Error) => void): this; once(event: "token", listener: (token: XOAuth2.Token) => void): this; prependListener(event: "error", listener: (err: Error) => void): this; prependListener(event: "end", listener: (token: XOAuth2.Token) => void): this; prependOnceListener(event: "error", listener: (err: Error) => void): this; prependOnceListener(event: "end", listener: (token: XOAuth2.Token) => void): this; listeners(event: "error"): Array<(err: Error) => void>; listeners(event: "end"): Array<(token: XOAuth2.Token) => void>; } export = XOAuth2;