We obtain new expressions for the Casimir energy between plates that are mimicked by the most general possible boundary conditions allowed by the principles of quantum field theory. This result enables to provide the quantum vacuum energy for scalar fields propagating under the influence of a one-dimensional crystal represented by a periodic potential formed by an infinite array of identical potentials with compact support.