How to reply to an e-mail (Gmail) filtered based on keyword using if statement

Hello Everyone.

I have a query regarding sending of SMTP messages. I need to know how to send a reply to a particular email address which was filtered out using if statement. The bot i created can search for a keyword in the gmail messages and once the email is found, it can reply back with attachments. The bot is able to send back emails to my email ID. The only problem i am facing is how to reply back to those senders where the keywords were extracted?
Please suggest.

Anyone who may help here will really appreciate.

Hi, How could you resolve this topic?