Using a local checkout method, the code for storing the order information and sending the email will only be executed if the transaction is successfull. With a local checkout method the code on the confirm page is processed in this order:
Process transaction through gateway
If Transaction Fail:
redirect to checkout failure page.
The redirect to the failure page causes the confirm page to stop processing.
If it does not redirect, it continues through the confirm page to store the order info in the database and send the email, then redirect to the success page.
There is no need for you to move the code to the success page as it will only occur if the transaction was successful.