Shop logout do no destroy my custom made $_SESSION['abcd'] variable

I have implemented the mail functionality in my custom module, And it sends an email by checking certain condition. But the problem it was sending email on every time that page loads.

So i put the check in $_SESSION[‘check’] variable and made the condition according to it,

But when user logs out, This $_SESSION[‘check’] variable doesn’t get away, its still in session, And because of that when a new user logs in on certain point he doesn’t get the email about something coming from module.

So my question is how can i just easily remove that $_SESSION variable i created, So that email condition on session works fine.

Any quick fix? I know it must be easy, but its quite urgent and have no time to explore things out.

Much appreciated, Thanks!

Actually i wanted to ask i can do that with any controller, but the shop core controllers are protected so…

Well, i made a workaround. Just also put the user_id in the session as $_SESSION['to']

And wrap it in that if the email has been sent, and if the email has been sent to this person.

Person would obviously be different so the email will shoot again. Compared with current $_SESSION variable.