As far as your teacher's statement, it is incorrect. It is entirely possible for a person to
attend Mass on Sunday in the state of grace, commit a mortal sin during the week, and attend Mass the next Sunday having already repented.
Indeed it is possible in theory to commit a mortal sin just after waking up on Sunday morning, experience contrition on the way to Mass, and attend Mass in a state of grace. Mere "feeling remorse", however, won't do the trick. Feeling bad about what you've done, or perhaps fearing that you'll go to hell, or even just that you'll be embarrassed by refraining from Communion - these things aren't enough. The Church calls them "imperfect contrition" or sometimes "attrition". They are morally helpful feelings, but not sufficient to forgive a mortal sin.
Among the penitent's acts contrition occupies first place. Contrition is "sorrow of the soul and detestation for the sin committed, together with the resolution not to sin again."
When it arises from a love by which God is loved above all else, contrition is called "perfect" (contrition of charity). Such contrition remits venial sins; it also obtains forgiveness of mortal sins if it includes the firm resolution to have recourse to sacramental confession as soon as possible.
(Catechism of the Catholic Church, paragraphs 1451–2; emphasis added. The quote is from the Council of Trent.)
As to your main question, though: If one's action arises from "the promptings of feelings and passions", can it thereby become, in effect, involuntary and thus not sinful?
No. The authors of the Catechism were very careful to say that these can "diminish the voluntary... character of the offense", rather than saying that they can remove it.
The Church understands that sometimes one's strong feelings can overcome reason, and cause someone to act in a way they know (rationally) is wrong. Aquinas, for example, says that
sometimes, when the passions are very intense, man loses the use of reason altogether: for many have gone out of their minds through excess of love or anger.
(Summa Theologica, First Part of the Second Part, Question 77, Article 2)
But this loss of reason doesn't necessarily excuse a person entirely. The Catechism does say that responsibility for one's actions "can be diminished or even nullified" (paragraph 1735) by a number of factors. Aquinas agrees, but says that strong conditions apply in order to remove freedom (and thus responsibility) altogether.
Sin consists essentially in an act of the free will, which is a faculty of the will and reason; while passion is a movement of the sensitive appetite.... Accordingly if we take passion as preceding the sinful act, it must needs diminish the sin: because the act is a sin in so far as it is voluntary, and under our control. Now a thing is said to be under our control, through the reason and will: and therefore the more the reason and will do anything of their own accord, and not through the impulse of a passion, the more is it voluntary and under our control. In this respect passion diminishes sin, in so far as it diminishes its voluntariness.
(Summa, First Part of the Second Part, Question 77, Article 6)
In other words, if the strong feeling comes (logically speaking) before the sin, it can impede the use of reason and therefore the ability to act rationally. This diminishes one's responsibility and therefore one's sin.
If, however, the cause [of a person's actions] be not voluntary but natural, for instance, if anyone through sickness or some such cause fall into such a passion as deprives him of the use of reason, his act is rendered wholly involuntary, and he is entirely excused from sin. Sometimes, however, the passion is not such as to take away the use of reason altogether; and then reason can drive the passion away... wherefore such a passion does not excuse from sin altogether.
(Summa, First Part of the Second Part, Question 77, Article 7)
Now in the particular case you mention, there are possible psychological factors that could diminish responsibility. In particular, there seems to be discussion among experts regarding pornography as an addiction, or as an obsession. Either of these cases could diminish personal responsibility by diminishing the amount of control the rational mind has over the action. (This would not, however, remove the individual's responsibility to care for their mental health so as to become better able to control their actions rationally.)
Now, neither obsession nor addiction describe the case you bring up. In such a case, the person makes an active choice to do something objectively wrong, and serious. This is precisely what is meant by a mortal sin. The fact that this action is consequent to "feelings and passions" makes it more obviously voluntary, not less (as pointed out in another answer).