I find your description a bit confusing. I've tried to pick out the main points:
ESP-2 is configured to send mails. It has pin X? configured as an input pin. If it detects a specific state on pin X? ( HIGH ? LOW ? ) it triggers a mail. It has IP address 192.168.0.? in your local network.
ESP-1 is configured as a web server. It has IP address 192.168.0.20? in your local network. GPIO5 is an output pin and is set HIGH when you issue the command Http://192.168.0.20/5/ON in a web browser.
ESP-3 is configured as a web server. It has IP address 192.168.0.? in your local network. It has pin GPIO5 defined as an input pin. When it detects that GPIO5 goes HIGH, you want some action? to be applied to ESP-1. It is not clear if this is through an electrical connection - pin manipulation, or sending it a command via a URL.
GPIO2 is configured as an output pin. It's value changes when ? occurs.
Can you complete the missing (or unclear) information where a ? appears above.
Can you somehow represent your architecture (ESP-1, 2 and 3 with the pins you have mentioned) on a hand drawn sketch and attach a picture to this thread.
Distinguish between physical buttons (say attached to GPIO pins) and buttons which appear on a web page.