Yes, what you're trying to do is fine.
So, there must be an error or two in the code.
First, the correct HOOK file name for this is "formmail-postconfig.inc.php".
This ensures you're changing TARGET_EMAIL after the configuration section.
The second concern would be the return of fetchAll. Does it return an array of rows, or a single row?
If a single row, then you need "$the_email['email']" instead.
To check everything, add this code to the end of the hook file: