The 39 Articles sums it up nicely:
XXVI. Of the Unworthiness of the Ministers, which hinders not the effect of the Sacraments.
Although in the visible Church the evil be ever mingled with the good, and sometimes the evil have chief authority in the Ministration of the Word and Sacraments, yet forasmuch as they do not the same in their own name, but in Christ's, and do minister by his commission and authority, we may use their Ministry, both in hearing the Word of God, and in receiving the Sacraments. Neither is the effect of Christ's ordinance taken away by their wickedness, nor the grace of God's gifts diminished from such as by faith, and rightly, do receive the Sacraments ministered unto them; which be effectual, because of Christ's institution and promise, although they be ministered by evil men.
Nevertheless, it appertaineth to the discipline of the Church, that inquiry be made of evil Ministers, and that they be accused by those that have knowledge of their offences; and finally, being found guilty, by just judgment be deposed.