npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

opticore-mailer

v1.0.2

Published

opticore module mailer

Downloads

7

Readme

OptiCore Mailer

Overview

OptiCore Mailer will allow to choose and configure the email transport they want to use. We'll define specific configurations for a service and create a method to instantiate the appropriate transporter based on the provided configuration

Installation

Usage

API Reference

  1. sendMail

    Purpose: Send mail and custom like you want a html

Signature:

sendMail(from: string, to: string, subject: string, html: string, attachments?: SendMailOptions['attachments']): Promise<void>

Parameters:

  • from (string): It's a static address that will be used unless an explicit from address is set on the Email.
  • to (string): It's a static address that will be used unless an explicit to address is set on the Email.
  • subject (string, optional): This a subject of mail.
  • html (string): This a view of mail and his content
  • attachments [{ filename?: string | false | undefined; cid?: string | undefined; encoding?: string | undefined; contentType?: string | undefined; contentTransferEncoding?: "7bit" | "base64" | "quoted-printable" | false | undefined; contentDisposition?: "attachment" | "inline" | undefined; headers?: Headers | undefined; raw?: string | Buffer | Readable | AttachmentLike | undefined; }]: send mail to add any file in attachments from streams and buffers using. It's accepts a readable stream or the buffer.

Returns:

  • Promise: string.

    possible return value.

    If successful, it returns a message that the mail was sent successfully.

    In case of error it will simply log the error and return it Example

import { MailerService, ServiceName } from 'opticore-mailer';

(async() => {
    const credential = {user: "azerty", pass: "21dc!@dvf"};
    const mail = new MailerService({
        service: ServiceNameEnums.gmail,
        host: "define a host",
        port: 1234,
        pool: true,
        secure: true,
        auth: {
            user: credential.user,
            pass: credential.pass
        }
    });
    await mail.sendMail(
        {
            to: "define sender mail",
            from: "define receiver mail",
            subject: "define the subject",
            html: "content can be html or text, no matter what"
        }
    );
})();
  1. sendMailWithEmailTemplate

    Purpose: Send mail with a template html Signature:

sendMailWithEmailTemplate(from: string, to: string, subject: string, user: any, mailTitle: string,
                                           mailContent: string, urlAction: string, buttonActionTitle: string,
                                           buttonBackgroundColor: any, buttonColor: any, greatingWord: string,
                                           footerAllRightReservedText: string, allRightReservedYears: number, 
                                           appName: string, conditionUsingText: string, politicsText: string, protocol: string,
                                           attachments?: SendMailOptions['attachments']): Promise<any>

Parameters:

  • from (string): It's a static address that will be used unless an explicit from address is set on the Email.
  • to (string): It's a static address that will be used unless an explicit to address is set on the Email.
  • subject (string, optional): This a subject of mail.
  • user (any): User object
  • mailTitle (string): An email title
  • mailContent (string): An mail content
  • urlAction (string): url action
  • buttonActionTitle (string): A button title
  • buttonBackgroundColor (string): Button background color
  • buttonColor (string): A button color
  • greatingWord (string): The word of greeting
  • footerAllRightReservedText (string): In this prt you may to include
  • allRightReservedYears (string): Include the mention all rights reserved as well as the year if you want.
  • appName (string): The name of the application you want to appear on the email template
  • conditionUsingText (string): Using condition text
  • politicsText (string): politics text
  • attachments [{ filename?: string | false | undefined; cid?: string | undefined; encoding?: string | undefined; contentType?: string | undefined; contentTransferEncoding?: "7bit" | "base64" | "quoted-printable" | false | undefined; contentDisposition?: "attachment" | "inline" | undefined; headers?: Headers | undefined; raw?: string | Buffer | Readable | AttachmentLike | undefined; }]: send mail to add any file in attachments from streams and buffers using. It's accepts a readable stream or the buffer.

Returns:

possible return value.

If successful, it returns a message that the mail was sent successfully.

In case of error it will simply log the error and return it

Example

import { MailerService, ServiceName } from 'opticore-mailer';

(async() => {
    const credential = {user: "azerty", pass: "21dc!@dvf"};
    const mail: MailerService = new MailerService({
        service: ServiceNameEnums.gmail,
        host: "",
        port: 1234,
        pool: true,
        secure: true,
        auth: {
            user: credential.user,
            pass: credential.pass
        }
    });

    let user = { username: "BesKane", email: "[email protected]"}
    await mail.sendMailWithMailTemplate({
        to: "define sender mail",
        from: "define receiver mail",
        subject: "define the subject",
        html: "content can be html or text, no matter what"
        html: {
            appName: "application name", allRightReservedYears: 2024, user, mailTitle: "mail title", mailContent: "mail content", urlAction: "url action", buttonActionTitle: "action button title",
            buttonColor: "define string color", buttonBackgroundColor: "background color", conditionUsingText: "", footerAllRightReservedText: "All right reserved", politicsText: "politics",
            greatingWord: "welcome", protocol: "http"
        },
    });
})();

Security Issues

https://github.com/guyzoum77/opticore-mailer/issues

Contributing

OptiCore mailer module is an Open Source, so if you would like to contribute, you're welcome. Clone repository and open pull request.

About

OptiCore mailer module is led by Guy-serge Kouacou and supported by Guy-serge Kouacou