First timer so be gentle.

I have been looking into this and can't seem to get any information so I'm hoping someone one here can help.

On our ecommerce site we want to send out an email to customers who have entered their email address but have abandoned their basket. I have seen several services where they say you add a piece of code to the page where a customer enters their details and regardless of whether or not the user clicks continue, the email address is still captured so a friendly email (and offer) can be sent to that person.

My question is simply how is this done?

All my coding has always involved the user clicking the submit button to get the details, how can you get the details without this happening?