Confirm email and get credentials from leter

I have a form and after submitting I get letter with credentials on my gmail mail. How can I automate this to validate that letter were received and store from letter login and password? And I want to do this using imap or rest api

Or how can I verify letter using subject, enter it and store a some text?

Hi Vlada Aleksandrova,

How did you solve this issue? I too have to click on a particular email to activate an account.

Any solution for this problem, same problem but with an institutional/corporate email.