[SalesForce] How to get https link using URLFOR() in Email Template

So, I'm trying to build a link to a visualforce page in an email template and the following works… almost.

The only problem is that I'm getting a non-ssl link (http:// instead of https://)

<a href='{!URLFOR('/apex/SomePage', null, [id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"])}'>Go to SomePage here!</a>

This causes the obvious problem of users having to log in to salesforce every time they click this link even if they are already logged in.

Best Answer

As a workaround, how about

<a href='{!SUBSTITUTE(URLFOR('/apex/SomePage', null, [id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"]),'http:','https:')}'>Go to SomePage here!</a>

Edit - added colons to the Substitute parameters