You need to have some indication that the user has closed the page and report that event to the server. There are a number of ways that the user can close the page (click a link to a new page, select a bookmark in his browser, type a new URL into his browser, shut down his browser, yank the power cord from the wall, etc.) Some of these events do not give the system any chance to send a message to the server that the page is closed. Therefore, you will need to have multiple ways of checking to see if he's not on the page anymore.
As HoangLong said, checking to see if the session expired is a good start. That way, if someone leaves the site and you're not notified, it's pretty safe to say that they aren't still reading the email three weeks later and it's safe to delete those images. You can't rely on this too much, however, because if someone uses the site once an hour for the next 20 years (which is normal for email reading), then the session never expires and you are maintaining files that he has long since stopped looking at. Therefore, you will need to look for a few other clues. Here's how I would do it:
This is the best one: When he is viewing any page on your site, you can delete anything that isn't related to this page. For example, if he is reading email #1234, then you can delete those files from email #1111. Likewise, if he is looking at your home page or your "list of emails" page, then you can delete all his temp email files. If he clicks a bookmark in his browser, however, he won't ever get to some other page on your site to delete this email's temp files.
You can put an onClose Javascript command on the page in the <body> tag that uses Ajax to send a message to the server that email #1234 has just been abandoned. This way, if he clicks a bookmark in his browser and leaves your site, you will have some notice that he left. Not everyone has Javascript turned on, however, so this isn't foolproof.
So between the expired sessions, the JS onClose Ajax notify, and each page deleting temp files not related to that page, it would be impossible for anything to last longer than the session's age... but most of the time, they would die before that.