The effect of the sacraments comes ex opere operato (by the very fact of being administered). Since it is Christ who works through them, their effectiveness does not depend on the worthiness of the minister. The belief that the validity of the sacrament is dependent upon the holiness of the administrator was rejected in the Donatist crisis.
However, an apparent administration of a sacrament is invalid, if the person acting as minister does not have the necessary power (as if a deacon were to celebrate Mass).
They are also invalid if the required “matter” or “form” is lacking. The matter is the perceptible material object, such as water in baptism or wheaten bread and grape wine for the Eucharist, or the visible action.
The form is the verbal statement that specifies the signification of the matter, such as, (in the Western Church), “N., I baptize thee in the name of the Father, and of the Son, and of the Holy Ghost”. Furthermore, if the minister positively excludes some essential aspect of the sacrament, the sacrament is invalid. This last condition lies behind the 1896 judgement of the Holy See denying the validity of Anglican Orders.