Currently erpnext uses the email address in the contacts doc to autofill the to address when emailing something.
Where in the code would i go to change this to use the email in the address doc instead?
For a basic search for instances of a string within a file (based on file extension say js for client side & py for server side code) check this
In a browser for a given page ‘View Page Source’ will give you clues too.
To search the code repository itself is another possible option if you prefer
Hope this helps