Quite simply, if you want HTML voicemail email notifications to work you have to define the content type to be text/html. Here’s what I came up with that’s a super simple hack, but it works and allows me to send HTML voicemail notifications.
Create the file in /usr/local/bin/htmlsendmail and put the following in it:
#!/bin/bash
VALUE=$(cat)
NEWVAL=$(sed 's/Content-Type: text\/plain/Content-Type: text\/html/g' <<< "$VALUE")
echo "$NEWVAL" | /usr/sbin/sendmail -t -v
Make it executable:
chmod +x /usr/local/bin/htmlsendmail
Now in Settings >> Voicemail Admin >> Settings >> Email Config set the Mail Command option to be /usr/local/bin/htmlsendmail
Here’s an HTML template you can try out:
<html>
<body>
<p>${VM_NAME},
<br><br>
There is a new voicemail in mailbox ${VM_MAILBOX}:</p>
<p>
<table>
<tr>
<th align="left">From (NAME):</th>
<td>${VM_CIDNAME}</th>
</tr>
<tr>
<th align="left">From (Number):</td>
<td><a href="tel://${VM_CIDNUM}">${VM_CIDNUM}</a></td>
</tr>
<tr>
<th align="left">Length:</td>
<td>${VM_DUR} seconds</td>
</tr>
<tr>
<th align="left">Date:</td>
<td>${VM_DATE}</td>
</tr>
</table></p>
<p>Dial *98 to access your voicemail by phone.<br>
Visit <a href="https://your.freepbx.tld">https://your.freepbx.tld</a> to check your voicemail with a web browser.</p>
</body>
</html>
Have fun!