Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adonis-mailbuilder

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-mailbuilder

AdonisJS 5 mailbuilder

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by800%
Maintainers
1
Weekly downloads
 
Created
Source

Table of contents

  • AdonisJS 5 mailbuilder

AdonisJS 5 mailbuilder

Adonis, mailbuilder, mailgen, livereloading

travis-image typescript-image npm-image license-image

How it works

  • Declarative creation of mails in classes (based on mailgen)
  • Livereload as CLI command (for quickly devloping your emails)
  • Mock data for tests (so that letters developed through livereload correspond to real letters that will go to the mail)
  • Naturally everywhere Typescript is used
  • CLI command to quickly create a Mailbuilder class based on the principle of "node ace make:model ModelName"

Installation

Install it:

npm i --save adonis-mailbuilder

Connect all dependences:

node ace configure adonis-mailbuilder

Create yor first mail

node ace mailbuilder:make AnyName

Start dev server

npm run dev

Go to url from cli like 'http://localhost:3333/mailbuilder'

Go to app/MailBuilder/AnyName.ts and change any options

Send your email

import MailBuilder from '@ioc:Adonis/Addons/MailBuilder'
import AnyName from 'App/MailBuilder/AnyName'
import Mail from '@ioc:Adonis/Addons/Mail'
import Env from '@ioc:Adonis/Core/Env'
export default class AuthController {
  public async register ({ auth, request, response }: HttpContextContract) {
    const { text, html } = await MailBuilder.render(
      new AnyName({ name: 'AnyName' })
    )
    await Mail.send(mail => {
        mail.subject('Thanks for registering')
        mail.text(text)
        mail.html(html)
        mail.to(ctx.session.email)
        mail.from(Env.get('MAIL_FROM') as string)
    })
  }
}

Docs for mailbuilder configuration

See docs

Keywords

FAQs

Package last updated on 03 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc