Coder Social home page Coder Social logo

sendemail's Introduction

@monkey_king/sendemail

A node package to send emails built on top of nodemailer. This package uses mailgun as transporter for now...

Installation

To get started, run:

npm i @monkey_king/sendemail

Usage

To use this package, you will need an account at https://www.mailgun.com/.

To use this, in an ECMAScript, you will need to:

import { sendEmail } from "@monkey_king/sendemail";

const send = () => {
  sendEmail(
    auth, //required. will be the authentication object required by mailgun
    //auth = {auth: {api_key: <Your private key>, domain: <Your domain>}}

    sender, //required. string of the email sending the mail.
    //It should be the same as the one used to create mailgun account

    recipient, //required. Array of the list of emails to send to. They should
    // be verified emails if you are using a free foundation plan in mailgun

    subject, //required. string of the email subject

    emailContent, //required. html passed as a string (ex: '<h1>Hello everyone</h1>')

    callback //optional, takes two params. (error, result) => ...
  );
};

Example:

import {sendEmail} from '@monkey_king/sendemail'

const auth = {
    auth: {
        api_key: <Your API key>,
        domain: <Your domain>
    }
}

const emailContent = `
    <div>
        <h1>Hello</h1>
        <p>Welcome to the party</p>
    </div>
`

const send = () => {
    sendEmail(
        auth,
        sender@gmail.com,
        ["[email protected]", "[email protected]"],
        "Test the package",
        emailContent
    )
}

To use this, in an CommonJS, you will need to:

const { sendEmail } = require("@monkey_king/sendemail");

/**
 * Rest of code goes here as for ECMAScript
 */

What next?

We will be building to add aws SES and other transporters

Contributing

Your pull request is one button away, don't hesitate. Face any issue? let us know

License

This has an MIT license.

sendemail's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.