Thermal Casimir effect with general boundary conditions