Secondly, there is the virtual intention. Its force is borrowed entirely from a prior volition which is accounted as continuing in some result produced by it. In other words, the virtual intention is not a present act of the will. but rather a power (virtus) come about as an effect of a former act, and now at work for the attainment of the end. The thing therefore that is wanting in a virtual, as contrasted with an actual, intention is not of course the element of will, but rather the attention of the intellect, and that particularly of the reflex kind. So, for example, a person having made up his mind to undertake a journey may during its progress be entirely preoccupied with other thoughts. He will nevertheless be said to have all the while the virtual intention of reaching his destination. Thirdly, a habitual intention is one that once actually existed, but of the present continuance of which there is no positive trace; the most that can be said of it is that it has never been retracted.
Virtual is sufficient, habitual insufficient. Intention is always presumed when the rite prescribed by the Church is followed, however:
The Church does not judge about the mind and intention, in so far as it is something by its nature internal; but in so far as it is manifested externally she is bound to judge concerning it. A person who has correctly and seriously used the requisite matter and form to effect and confer a sacrament is presumed for that very reason to have intended to do (intendisse) what the Church does. On this principle rests the doctrine that a Sacrament is truly conferred by the ministry of one who is a heretic or unbaptized, provided the Catholic rite be employed. (Leo XIII, Apostolicae Curae)