Use the Get IMAP Mail Messages or Get Outlook Mail Messages activity, depending on your email provider.
Set up the activity to fetch emails from your inbox. Use filters if necessary to retrieve only relevant emails (e.g., using a subject filter like “Your Copilot security code”).
Extract the OTP:
Loop through the retrieved emails and use the For Each activity to process each mail.
Use the MailMessage.Body property to get the email body text.
Use Regex to extract the OTP code. For example, if your OTP is always a 6-digit number, you can use the pattern \b\d{6}\b to match it.Example:
If multiple emails are received, you may want to sort emails by date and pick the latest one or add further conditions to ensure you’re extracting the correct OTP.
Use the OTP:
After extracting the OTP, you can use it in your workflow