Appearance
Notifications
Mail Integration with Notifications
When both the mail and notifications packages are installed, Holo-JS automatically bridges notifications email delivery through the mail system.
How It Works
- When a notification is sent via the email channel
- Holo-JS checks if the mail package is installed
- If mail is available, the notification is converted to a mail message
- The mail is sent using your configured mail drivers
Configuration
No additional configuration is needed - the integration happens automatically when both packages are installed.
Customizing Notification Emails
You can customize how notifications are converted to mails by defining a custom mail builder in your notification:
ts
import { defineNotification } from '@holo-js/notifications'
interface InvoicePaidNotification {
readonly invoiceNumber: string
}
const invoicePaid = defineNotification({
type: 'invoice-paid',
via() {
return ['email']
},
build: {
email(data: InvoicePaidNotification) {
return {
subject: `Invoice #${data.invoiceNumber} paid`,
markdown: `# Invoice Paid\n\nInvoice #${data.invoiceNumber} has been successfully paid.`,
// You can also specify mail-specific options here
// like attachments, cc/bcc, etc.
}
},
},
})