waitForMessages(...) when one action should send several emails.
Add A Delay Before Polling
Some systems enqueue email work in the background. Usedelay to wait before the first poll.
waitForMessagesDefaultDelayMs configuration.
Work With The Results
waitForMessages(...) returns matching parsed emails. Do not depend on sorting unless your runtime documents that ordering.
For the exact waitForMessages(...) options, see the Mail Reference.