Advanced
OTP patterns
Teach SendMock your app's code format, so codes are extracted from every email and SMS.
Try it in the demo.
SendMock finds one-time codes with regular expressions. The defaults catch the usual "Your code is 482913". If your app writes codes another way (ABC-123, a code in a link, an 8-letter token), add a pattern.
Steps
- Open Settings > OTP patterns.
- Add a pattern. The first capture group is the code, for example
Login code: ([A-Z]{3}-\d{3}). - Paste one of your app's messages into Try a message: it shows which pattern matched and the code, or "No code found."
- Order matters: patterns are tried top to bottom on every new email and SMS, and the first match wins. Move yours above the defaults if both match.
- Press Save changes. Invalid patterns are flagged; Restore defaults brings back the shipped list.
New messages show the code with a copy button, and sendmock otp and the sendmock_otp_get MCP tool return it.
In the seed file
[settings]
otp_patterns = ["Login code: ([A-Z]{3}-\\d{3})", "\\b(\\d{6})\\b"]