There are many types of email and SMS messages that PortaBilling sends to your administrative and end users: notifications that a balance approaches its credit limit, statistics summaries, different alerts sent to administrators, etc.
The notification messages are managed via notification templates. There are two types of notification templates:
- customer class notifications
- user notifications.
Both template types contain a set of notification messages. You can customize the language and content of these messages, e.g., add the "Company name" variable to the "Credit limit exceeded" notification.
To enable the notifications on a customer class or user, first, create a notification template. Then open the Notifications panel and assign the notification template. When the template is assigned, select which notifications to send individually for each customer class or user. You can select a specific notification group or particular notifications from each notification group.
To edit the email or SMS notification messages, open the required notification template and modify the subject, BCC, and body of the notification. The changes will apply to all the entities this template is assigned to.
Notification messages syntax
NOTE: Notification messages use basic HTML::Mason syntax; you can find more information on the
Here is an example of the default Credit limit exceeded notification message:
Subject: Credit limit exceeded - services are now blocked
BCC: admin@portaone.com
Body:
Dear <% $greetings %>, We would like to inform you that the current balance on your account <% $companyname ? $companyname : $name %> has reached its credit limit and your service is now blocked. Your balance: <% $balance %><% $currency %> Your credit limit: <% $credit_limit %><% $currency %>
Variables:
greetings companyname
name
balance
credit_limit
currency
Each template contains subject, BCC, body and variables sections. The variables section defines the parameters (e.g., Current customer balance) that can be used in the body section.
The subject section contains the text to be entered in the subject line of the outgoing email (e.g., Credit limit exceeded).
The BCC section contains email addresses of persons who want to receive a copy of this notification. You can specify more than one valid email address; make sure you separate them with commas.
The body section contains the text which will be used as the email body text. Any normal text entered here will appear unchanged in the email. If you want to include the current value of a certain parameter in the text, enclose the parameter variable in <% %> as shown below:
Your credit limit: <% $credit_limit %><% $currency %>.
In fact, you may include mini-pieces of Perl code in <% %>. For instance, the line below includes a conditional statement, and will produce either a company name (if one is defined) or a customer name:
<% $companyname ? $companyname : $name %>
You may also use the following service functions for editing email notification templates:
- column (text, width => N, align => ‘left’|’right’) – this outputs a space padding string of a given width. The text alignment can be either flush left or flush right. By default, text alignment is set to the left.
The function’s parameters are:
- text – defines the text to output
- N – defines the width of the output string
- align – defines the string alignment (can be either left- or right-aligned)
- line (char, width) – this outputs a string of repeated characters (e.g., it can be used to display underlined text). The function’s parameters are:
- char – defines the character to output
- width – defines how many times to output the char parameter
For example, the following code:
<% column('Previous Balance:', width => 45) %> <% column($previous_balance, width => 10, align => 'right') %> <% line('-', 25) %>
will output the following string:
Previous Balance: 10.00 -------------------------
In APPENDIX D. Available Notification Messages, you can find email notification messages and their descriptions.