You can connect a heatsink through a metal plate, e.g. a box/enclosure wall, if the surfaces are clean, smooth and bare, and you clamp both parts hard to the plate and use thermal grease on both sides of the plate. You should probably oversize the SSR, or the heat sink in this case though, or add a fan.