Extract dynamic otp from email

Hi experts,
how do I extract the 6 digits otp from outlook?

You can use Regex expression or String Manipulation (If text is always same) to get the otp from mail body.

Hi @sophiey

System.Text.RegularExpressions.Regex.Match(inputstring,"(?<=OTP.*)[A-Z]+\-?\d*(?=\.)").Value

Go through the below thread

Hope it helps!!

Hi,

  1. Use the “Get Outlook Mail Messages activity” to read emails.
  2. Use a “For Each” activity to iterate through the emails
    Use regular expressions to extract the OTP
    Assign activity:
    otpValue=System.Text.RegularExpressions.Regex.Matches(emailBody, “(\d{6})”)

Hi @sophiey

Try this

System.Text.RegularExpressions.Regex.Match(Input.ToString,"((?<=OTP is\s+\w+\-?)\d+").Value

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.