1.0.3 • Published 1 year ago

@cabysis/mail-man v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Email Sender Package

Mail-Man sender package is a TypeScript library for sending emails easily using SMTP created by CabySis.

Installation

You can install the lastest version as:

    npm install @cabysis/mail-man

Usage

You can use this library after installation as this example:

import { sendMail, SendMailOptions, Providers, FileMeta } from '@cabysis/mail-man';  // Import necessary modules

// Define file metadata
const filesMeta: FileMeta[] = [
  FileMeta.create({ filePath: "path/file.txt" }), // Create file meta by file stored on path
  FileMeta.create({
    // Create file meta by buffer and file name
    buffer: Buffer.from("file buffer example"),
    fileName: "file.txt",
  }),
];

// Define email options
const sendMailOptions: SendMailOptions = {
  subject: 'This is a subject',                   // Define email subject
  message: 'This is email body message.',         // Define email body
  recipients: ['your_email@example.com'],         // Define the email receivers list
  filesMeta,                                      // Include files metadata
  provider: Providers.YourProviderName,           // Specify the email provider
  apiKey: 'your_api_key',                         // Specify the API key
};

// Send the email
sendMail(sendMailOptions)
  .then(() => {
    console.log('Email sent successfully.');
  })
  .catch((error) => {
    console.error('Error sending email:', error);
  });
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago