Below is the mail body format
You recently logged in to Salesforce from a browser or app that we don’t recognize.
Operating System: Windows 10
To ensure your account’s security, we need to verify your identity. Enter the following code where prompted by Salesforce.
Verification Code: 602062
If you didn’t recently log in to Salesforce, or you don’t recognize this browser or operating system, contact your Salesforce administrator.
Can you try this,
str = “Verification Code: 602062”
verificationCode = System.Text.RegularExpressions.Regex.Match(str,“((?<=Verification Code: ).*)”).ToString
To be more precise and only get numbers please try this
VerfCode = System.Text.RegularExpressions.Regex.Match(str,“(?<=Verification Code:\s)\d+”).ToString
PS: If you copy paste replace the inverted comma in your code again
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.