Skip to main content

MailerService

@webda/core


Interface: MailerService

Defined in: packages/core/src/services/mailer.service.ts:37

Represent a mailer service

Extends​

Properties​

_compiledCapabilities​

protected _compiledCapabilities: Record<string, any> = {}

Defined in: packages/core/src/services/iservice.ts:58

Capabilities detected at compile-time from @WebdaCapability-tagged interfaces.

Populated during Service.resolve by reading the service's entry in webda.module.json. Each key is a capability name (e.g., "request-filter"), and the value is an empty object {} by default. Override getCapabilities to provide capability-specific configuration or to conditionally disable capabilities.

See​

getCapabilities

Inherited from​

NotificationService._compiledCapabilities


name​

readonly name: string

Defined in: packages/core/src/services/iservice.ts:35

Inherited from​

NotificationService.name


parameters​

readonly parameters: ServiceParameters

Defined in: packages/core/src/services/iservice.ts:36

Inherited from​

NotificationService.parameters

Methods​

addListener()​

addListener<Key>(eventName, listener): this

Defined in: packages/core/src/events/asynceventemitter.ts:83

Type Parameters​

Key​

Key extends never

Parameters​

eventName​

Key

the event name

listener​

(event) => void | Promise<void>

the event listener

Returns​

this

this for chaining

See​

EventEmitter.addListener

Inherited from​

NotificationService.addListener


emit()​

emit<Key>(eventName, event): Promise<void>

Defined in: packages/core/src/events/asynceventemitter.ts:165

Emit an event for this class

Instead of returning a boolean, this method returns a Promise so you can decide to wait for the event to be processed or not

Type Parameters​

Key​

Key extends never

Parameters​

eventName​

Key

the event name

event​

object[Key]

the event name

Returns​

Promise<void>

See​

EventEmitter.emit

Inherited from​

NotificationService.emit


getCapabilities()​

getCapabilities(): Record<string, any>

Defined in: packages/core/src/services/iservice.ts:86

Return the capabilities of this service.

By default returns capabilities detected at compile-time from

Returns​

Record<string, any>

the result

Webda Capability-tagged​

interfaces in webda.module.json.

Override to disable capabilities based on configuration:

getCapabilities() {
const caps = super.getCapabilities();
if (!this.parameters.enabled) delete caps["request-filter"];
return caps;
}

Inherited from​

NotificationService.getCapabilities


getMaxListeners()​

getMaxListeners(): number

Defined in: packages/core/src/events/asynceventemitter.ts:90

Returns​

number

Inherited from​

NotificationService.getMaxListeners


getName()​

abstract getName(): string

Defined in: packages/core/src/services/iservice.ts:107

Get the name of the service

Returns​

string

Deprecated​

use name directly

Inherited from​

NotificationService.getName


getOpenApiReplacements()​

abstract getOpenApiReplacements(): object

Defined in: packages/core/src/services/iservice.ts:115

Get OpenAPI replacements

Returns​

object

Inherited from​

NotificationService.getOpenApiReplacements


getState()​

abstract getState(): string

Defined in: packages/core/src/services/iservice.ts:101

Return the state of initialization

Returns​

string

Inherited from​

NotificationService.getState


handleNotificationFor()​

handleNotificationFor(userOrIdent): Promise<boolean>

Defined in: packages/core/src/services/notificationservice.service.ts:21

Check if the service can deliver notification to this user

Parameters​

userOrIdent​

User | Ident

Returns​

Promise<boolean>

Inherited from​

NotificationService.handleNotificationFor


hasNotification()​

hasNotification(notification): Promise<boolean>

Defined in: packages/core/src/services/notificationservice.service.ts:16

Check if this type of notification is available

Parameters​

notification​

string

Returns​

Promise<boolean>

Inherited from​

NotificationService.hasNotification


init()​

abstract init(): Promise<MailerService>

Defined in: packages/core/src/services/iservice.ts:93

Initialize the service

Returns​

Promise<MailerService>

Inherited from​

NotificationService.init


listeners()​

listeners(eventName): Function[]

Defined in: packages/core/src/events/asynceventemitter.ts:183

Get all listeners for an event

Parameters​

eventName​

never

the event name

Returns​

Function[]

the list of results

Inherited from​

NotificationService.listeners


off()​

off<Key>(eventName, listener): this

Defined in: packages/core/src/events/asynceventemitter.ts:141

Type Parameters​

Key​

Key extends never

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.off

Inherited from​

NotificationService.off


on()​

on<Key>(eventName, listener): this

Defined in: packages/core/src/events/asynceventemitter.ts:119

Type Parameters​

Key​

Key extends never

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.once

Inherited from​

NotificationService.on


once()​

once<Key>(eventName, listener): this

Defined in: packages/core/src/events/asynceventemitter.ts:108

Type Parameters​

Key​

Key extends never

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.once

Inherited from​

NotificationService.once


removeAllListeners()​

removeAllListeners<Key>(eventName?): this

Defined in: packages/core/src/events/asynceventemitter.ts:150

Type Parameters​

Key​

Key extends never

Parameters​

eventName?​

Key

the event name

Returns​

this

this for chaining

See​

EventEmitter.removeAllListeners

Inherited from​

NotificationService.removeAllListeners


removeListener()​

removeListener<Key>(eventName, listener): this

Defined in: packages/core/src/events/asynceventemitter.ts:130

Type Parameters​

Key​

Key extends never

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.removeListener

Inherited from​

NotificationService.removeListener


resolve()​

abstract resolve(): this

Defined in: packages/core/src/services/iservice.ts:97

All services should be able to resolve themselves

Returns​

this

Inherited from​

NotificationService.resolve


send()​

send(options, callback): Promise<any>

Defined in: packages/core/src/services/mailer.service.ts:45

Send an email

Parameters​

options​

MailerSendOptions

Options to pass to the sendMail option of the nodemailer module

callback​

() => void

Callback to pass to sendMail

Returns​

Promise<any>

Promise resolving when the email is sent


sendNotification()​

sendNotification(user, notification, replacements): Promise<void>

Defined in: packages/core/src/services/notificationservice.service.ts:28

Send the notification to the user

Parameters​

user​

User | Ident

notification​

string

replacements​

any

Returns​

Promise<void>

Inherited from​

NotificationService.sendNotification


setMaxListeners()​

setMaxListeners(n): this

Defined in: packages/core/src/events/asynceventemitter.ts:97

Parameters​

n​

number

Returns​

this

Inherited from​

NotificationService.setMaxListeners


stop()​

abstract stop(): Promise<void>

Defined in: packages/core/src/services/iservice.ts:111

Stop the service

Returns​

Promise<void>

Inherited from​

NotificationService.stop