dyna-email-sender
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

About

Send emails easily! From Node.js

In Typescript.

Example

import {DynaEmailSender} from "dyna-email-sender";

const sender = new DynaEmailSender({
  host: 'smtp.ethereal.email',
  port: 587,
  tls: false,
  username: 'info@my-company.com',
  password: 'pass-matters',
  allowInvalidCertificates: false,
});

sender.send({
  fromTitle: 'Info My Company 👻',       
  fromAddress: 'info@my-company.com',    
  toAddress: 'lola@foo.co',             // or array of addresses
  subject: 'Hello ✔', 
  text: 'Hello world?',
  html: '<b>Hello world?</b>',
})
  .catch((error: IError) => {
    console.log('email send failed', {error});
  });

Methods

send(email: IEmail): Promise

interface IEmail {
  fromTitle: string;
  fromAddress: string;
  toAddress: string | string[];
  subject: string;
  text: string;
  html: string;
}

close(): void

Closes any open connection

Readme

Keywords

none

Package Sidebar

Install

npm i dyna-email-sender

Weekly Downloads

4

Version

1.0.4

License

MIT

Unpacked Size

41.4 kB

Total Files

57

Last publish

Collaborators

  • dennisat