More reliable Base URL implementation in email templates

Fix #39