"So when they forgot that which they were reminded of," meaning: they denied what the Messengers brought to them.
"We opened to them the gates of everything," of provisions, "until, when they rejoiced in that which they were given," meaning: that which they were granted, "We seized them suddenly," meaning: with the punishment unexpectedly, "and thereupon they were in despair," meaning they despaired.
﴿فَلَمَّا نَسُوا مَا ذُكِّرُوا بِهِ﴾ أَيْ: ﴿كَذَّبُوا﴾ مَا جَاءَتْهُمْ بِهِ الرُّسُلُ.
﴿فَتَحْنَا عَلَيْهِمْ أَبْوَابَ كُلِّ شَيْء﴾ مِنَ الرِّزْقِ ﴿حَتَّى إِذَا فَرِحُوا بِمَا أُوتُوا﴾ بِمَا أعْطوا ﴿أَخَذْنَاهُم بَغْتَة﴾ يَعْنِي: بِالْعَذَابِ فَجْأَةً ﴿فَإِذَا هُمْ مبلسون﴾ ييأسون