1.9.5 • Published 11 months ago

vitemail v1.9.5

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Vitemail

Vitemail is a library for sending emails easily

Sections Breakdown

  1. module configuration
  2. service configuration
  3. type reference usage

Installation

 npm i vitemail

Usage

  1. Module Configuration

In your module file where you want to use it, provide your auth details to the authProvider method.

import { ViteMailModule } from "vitemail";

@Module({
  imports: [
    ViteMailModule.authProvider({
      email: "example@gmail.com",
      password: "*******",
    }),
  ],
})
export class AppModule {}

  1. Service Configuration

In your service file where you want to use it.

import { ViteMailService } from "vitemail";

// At the constructor inject it like nany other third party service
constructor(private vitemailService: ViteMailService) { }

// service function example
async sendEmail(emailDto: any): Promise<any> {
    try {
      const response = await this.vitemailService.sendEmail({
        sender: {
          email: "sender@gmail.com",
          name: "Test Sender"
        },
        receiver: {
          email: "receiver@gmail.com",
          name: "Test Receiver"
        },
        message: "Demo Testing",
        subject: "Demo"
      })
      console.log(response)
    } 
    catch (error) {}
  }

  1. Types example
import { VitemailOptions } from "vitemail";

const options: VitemailOptions = {
  // this is required for both the name and email
  sender: {
    email: "example@gmail.com",
    name: "sender name",
  },
  // the name of the receiver is not required
  receiver: {
    email: "example@gmail.com",
    name: "receiver",
  },
  message: "this is a message",
  replyTo: "example2@gmail.com",
  subject: "Testing",
  cc: "example4@gmail.com", // the same applies with the bcc field
};
1.6.2

11 months ago

1.5.1

11 months ago

1.4.1

11 months ago

1.9.5

11 months ago

1.9.4

11 months ago

1.9.2

11 months ago

1.9.0

1 year ago

1.8.0

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago