Skip to main content
All CollectionsUniFiUniFi - Advanced Guides
Rewriting UniFi email alerts with Mailparser and Postmark
Rewriting UniFi email alerts with Mailparser and Postmark

How to customize UniFi email alerts

Reilly Chase avatar
Written by Reilly Chase
Updated over 4 years ago

A common request that we have is how to change the UniFi alert email templates. For example, for most people, it would be helpful to have the site and device name in the alert email subject line, instead of the default template's subject which has the controller name and alert.

Although there are no options built into UniFi for customizing the emails, we can send the emails to a Mailparser email address, parse the relevant data from the emails, and then resend the emails out to Postmark to be delivered to email addresses of your choosing.

  1. Next, set up your Postmark account. You'll need to verify your domain to be able to send from it, and create a "server" in Postmark for the Mailparser emails to send to.

  2. Click on the server you created > Default Transactional Stream

4. Go to Setup Instructions > curl

5. Leave that page open, we'll be copying some of the settings from the curl example in step 7 to create the webhook integration in Mailparser
6. In Mailparser, go to Webhook Integrations > Add New Integration > Generic Webhook

7. Use the following settings, but replace the bold areas with your own information from step 5. You can also customize the Subject or HtmlBody of the email if you want to.

Basic Options
Name: This can be anything, I used "Postmark  webhook to rchase@hostifi.com"
Payload format: JSON
Target URL: https://api.postmarkapp.com/email

Advanced Options
HTTP Verb: POST
Repeating Data Behavior: One request per email
Data Structure: Custom - provide your own template
Structure template: {From: 'your-alerts-email-address@your-site.com', To: 'your-receiving-email-address@your-site.com', Subject: '[UniFi] Alert: {{site_name}} {{alarm}}', HtmlBody: 'Site: {{site_name}}\nAlarm: {{alarm}}\nDevice: {{device_name}}\nURL: {{controller_url}}'}
Additional Headers: X-Postmark-Server-Token: your-postmark-server-token

8. Click Save & Test. Check for any error messages.

Did this answer your question?