Hi,
Welcome to the RStudio community!
In order for us to help you with your question, please provide us a minimal reproducible example where you provide a minimal (dummy) dataset and code that can recreate the issue. Once we have that, we can go from there. For help on creating a Reprex, see this guide:
In this case, you did share code, but we cannot run this because we have no access to your emails. Also, if there is an error it would be nice to see the full error message.
At which step does your code crash? It it when trying to get the email, or during the processing. Also, if possible, try and show what goes into the "search" variable
Good luck!
PJ