Fix issue with Insight URLs in mandrill emails

The application_url used in the template was not being set before rendering
the insights fragment.

Also added test that the a url containing the host/?u= is in the insights
param sent to mandrill.
Merge pull request #1791 from cdmoyer/1787-Invalid-URLs-in-Insigh-via-Mandrill

Fix issue with Insight URLs in mandrill emails, closes #1787