I'm still wondering what you've broken in the code because the core remainder code calls the main email template handler, which always substitutes $scripturl in, but $scripturl is based on $boardurl which is set in the Settings.php file.
If you're using the email template editor mod, or pretty URLs, now would be the time to mention this - because I can't reproduce this even using a proxy on any site I operate.