so the details coming back from paypal are stored in the an array called "$keyarray"
I think your probably trying to access variables from the key array by the wrong name.
to see the contents of the $keyarray array including the variable names that you should be using, use the following code:
quite frankly, paypal standard is a bear of a system to work with. I would recommend express checkout instead, it is another free service from paypal and you wont have the issues like IPN and PDT.
you will need to sign up for api access, in eCart, select to use paypal payments pro, then delete the checkout form from the checkout page.
If you stick with standard, you will need to use the IPN page to send the UE receipt, there are many threads in this form that talk about IPN and sending the email.