How to Resolve: 
You need to modify your custom button code. We have listed an example of button code below using Lead object for what is would be normally to what you need to change it too:

Original Button Code
/apex/rsdoc__GenerateDocument?id={!Lead.Id}&templateId=GDT-000004&attach=true&output=pdf&emailAction=autosend&emailTo={!Lead.Id}&emailTemplate=00X28000001SwGo

Change Button Code To
{!URLFOR($Site.Prefix + ‘/apex/rsdoc__GenerateDocument?id=’ + Lead.Id + ‘&templateId=GDT-000004&attach=true&output=pdf&emailAction=autosend&emailTo=’ + Lead.Id + ‘&emailTemplate=00X28000001SwGo’)}