Skip to main content

Getting Started


The Mailgun Mail Module simplifies the process of integrating Mailgun's email services into your NestJS applications. It offers a streamlined approach to send emails, manage templates, and configure your email services with ease.

note

Before starting, make sure you have a Mailgun account and API credentials.

Getting Started

The Mailgun Mail Module simplifies the process of integrating Mailgun's email services into your NestJS applications. It offers a streamlined approach to send emails, manage templates, and configure your email services with ease.

Installation​

To begin using the Mailgun Mail Module, you need to install the package and its dependencies in your project:

yarn add @softkit/mail
# For Mailgun, install the official mailgun.js package
yarn add mailgun.js@^9.3.0

Basic Setup​

Start by importing the MailgunMailModule into your NestJS application module:

import { Module } from '@nestjs/common';
import { MailgunMailModule } from '@softkit/mailgun-mail-module';

@Module({
imports: [
MailgunMailModule.forRoot({
username: 'api',
key: 'YOUR_API_KEY',
domain: 'YOUR_DOMAIN',
defaultFromEmail: 'noreply@example.com',
}),
],
})
export class YourAppModule {}

Replace 'YOUR_API_KEY', 'YOUR_DOMAIN', and 'noreply@example.com' with your actual Mailgun API key, domain, and preferred sender email address.

Next Steps​