Use single variable to refer to the site URL
Factor out site URL calculation (issue #432)
Allow to force https for outging mail

Fixes #432