That does not mean there are not extraordinary ways that God can work outside of the sacraments. Note that this is for mortal sins, as venial sins can be forgiven routinely outside of the confessional. The canon says that physical and moral impossibility excuses one from confession.