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

props-lib-email

v0.0.2

Published

A simple email template and sender lib

Downloads

1

Readme

props-lib-email

A simple email sender based on AWS SES.

initialize the lib

import { LibEmailSender } from 'props-lib-email';
await LibEmailSender.init({
      logger: console, // A namespace with a log function x.log(...args)
      aws: {
        region: 'us-east-1',
        ses: {
          accessKeyId: 'KEY',
          secretAccessKey: 'SECRET',
        },
      },
    });

Example of a base template:

export default abstract class EmailTemplateBase {
	protected emailDisclaimer = '<br><br>--------<br><small>Legal Disclaimer: Read more about <a href="https://propsproject.com/">Props here</a>. The Securities and Exchange Commission (SEC) has qualified the offering statement that we have filed with the SEC. The information in that offering statement is more complete than the information we are providing now, and could differ in important ways. You must read the documents filed with the SEC before investing. The offering is being made only by means of its offering statement. This document shall not constitute an offer to sell or the solicitation of an offer to buy, nor shall there be any sale of these securities in any state or jurisdiction in which such offer, solicitation or sale would be unlawful prior to registration or qualification under the securities laws of any such state or jurisdiction. An indication of interest involves no obligation or commitment of any kind. Any person interested in investing in any offering of Props Tokens should review our disclosures and the publicly filed offering statement and the final offering circular that is part of that offering statement at <a href="http://offeringcircular.propsproject.com/">this website</a>. YouNow is not registered, licensed or supervised as a broker dealer or investment adviser by the Securities and Exchange Commission (SEC), the Financial Industry Regulatory Authority (FINRA) or any other financial regulatory authority or licensed to provide any financial advice or services. Forward-looking statements: This communication contains forward-looking statements that are based on our beliefs and assumptions and on information currently available to us. In some cases, you can identify forward-looking statements by the following words: “will,” “expect,” “would,” “intend,” “believe,” or other comparable terminology. Forward-looking statements in this document include, but are not limited to, statements about our plans for developing the platform and future utility for the Props Token, our Reg A+ offering and launch of our network, and collaborations and partnerships. These statements involve risks, uncertainties, assumptions and other factors that may cause actual results or performance to be materially different. More information on the factors, risks and uncertainties that could cause or contribute to such differences is included in our filings with the Securities and Exchange Commission, including in the “Risk Factors” and “Management’s Discussion & Analysis” sections of our offering statement on Form 1-A. We cannot assure you that the forward-looking statements will prove to be accurate. These forward-looking statements speak only as of the date hereof. We disclaim any obligation to update these forward-looking statements.</small>';
	protected body: string;
	protected args: { [key: string]: any };
	constructor(args: { [key: string]: any }) {
		this.args = args;
	}
	getBody(): string {
		return this.parseBody();
	}
	public abstract getSubject(...args): string;
	protected abstract parseBody(): string;

}

Example of a final template:

import BaseEmailTemplate from './base_email_template';
import { LibEmailInterfaces,  LibEmailHTMLComponents } from 'props-lib-email';
const { ButtonComponent, HtmlHeaderComponent } = LibEmailHTMLComponents;

const baseUrl = 'https://propsproject.com'

export default class EmailTemplateExample extends BaseEmailTemplate {
  protected body: string = `
  ${HtmlHeaderComponent.H({
    text: 'Hi, ',
    size: 1,
    backgroundColor: '#64b5f6',
    textColor: '#fff'
  })}
  ${HtmlHeaderComponent.H({
    text: 'How awesome are you?',
    size: 2,
    letterSpacing: 3,
  })}
  <p>Wanna join our awesome team?</p>
  <p>${ButtonComponent.RoundedButton({
    href: `${baseUrl}/careers/%s`, // %s will be replaced by token
    text: 'Join Us!',
    radius: 15,
    backgroundColor: '#64b5f6'
  })}</p><br><br>
  <p>All the best</p>
  Thank you,<br>
  Team Props
  <br><br>
  ${this.emailDisclaimer}
  `;
  protected args: IEmailTemplateArgs;
  constructor(args: IEmailTemplateArgs) {
    super(args);
  }

  protected parseBody(): string {
    const {
      token,
    } = this.args;
    const args = [token];
    var i = 0;
    return this.body.replace(/%s/g, () => args[i++])
  }
  public getSubject(): string {
    return 'Email Template Example'
  }

}
interface IEmailTemplateArgs {
  token: string;
}

Sending the email:

import { LibEmailSender } from 'props-lib-email';
const emailData: LibEmailInterfaces.IEmailData = {
      template: new EmailTemplateExample({token:'random-token-just-to-show-text-replace'}),
      emailAddress: '[email protected]',
    };
await LibEmailSender.send(emailData); // returns true/false