const { Mail } = require('expresso-provider')
import { Mail } from 'expresso-provider'
// config/mail.ts
import { Mail } from 'expresso-provider'
export const mailService = new Mail({
appName: 'My App',
driver: 'smtp',
host: 'smtp.mailtrap.io',
port: 2525,
username: 'noreply@your_company.com',
password: 'your_password',
})
mailService.initialize()
import { readHTMLFile } from 'expresso-core'
import { mailService } from 'config/mail'
import Handlebars from 'handlebars'
const filePath = '/your_path/template/emailRegistration.html'
const html = readHTMLFile(filePath)
const template = Handlebars.compile(html)
const mailTo = '[email protected]'
const subject = 'Account Registration'
const htmlToSend = template(data)
mailService.send(mailTo, subject, htmlToSend)