@careville/nestjs-mailer
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

@careville/nestjs-mailer

A simple NestJS module for sending careville styled emails using various providers (e.g. SMTP, Microsoft Graph). Supports React-based email templates via react-email.

Installation

npm install @careville/nestjs-mailer

Usage

In your NestJS application’s root module (e.g. AppModule), import the mail module with any configuration options you need:

import { Module } from '@nestjs/common';
import { MailModule } from '@careville/nestjs-mailer';

@Module({
  imports: [
    MailModule.register({
      isGlobal: true,
      type: "MS_GRAPH",
      sender: process.env.MAIL_SENDER,
      from: process.env.MAIL_FROM,
      msGraph: {
        tenantId: process.env.MS_GRAPH_TENANT_ID,
        clientId: process.env.MS_GRAPH_CLIENT_ID,
        clientSecret: process.env.MS_GRAPH_CLIENT_SECRET,
      },
    }),
  ]
})
@Injectable()
export class MyService {
  constructor(private readonly mailService: MailService) {}

  async sendEmail() {
    await this.mailService.sendMail("to@example.de", "Example Subject", "ReactElement")
  }
}

Publishing & Build

This package is built with Rollup. To build locally:

npm install
npm run build

Readme

Keywords

none

Package Sidebar

Install

npm i @careville/nestjs-mailer

Weekly Downloads

14

Version

1.1.1

License

Apache-2.0

Unpacked Size

409 kB

Total Files

36

Last publish

Collaborators

  • xetoxyc