That's incorrect. While so long as no contrary intention is expressed externally, the Sacrament is to be presumed valid, it could in fact be invalid if the priest had a contrary intention internally. Pertinent texts:
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. (Leo XIII, Apostolicae Curae, 33)
The minister's intention may be perverted in two ways. First in regard to the sacrament: for instance, when a man does not intend to confer a sacrament, but to make a mockery of it. Such a perverse intention takes away the truth of the sacrament, especially if it be manifested outwardly. (St. Thomas, Summa theologiae, III q. 64 a. 10)
OK, thanks.
We should presume validity if proper matter and form is present. We should NOT if they are not. That's OK.
What is the effect of sacramental grace, if any, in the case that proper matter and form are used, but the priest INTERNALLY did not intend...with the Church?
IIRC with regard this question, M4629 found text which cast doubt on any 'sacramental grace' ....