$folder->next_labeled_message(msg_num, label)
folder
msg_num
label
Returns the message number of the next message in the folder relative to msg_number that has the label label associated with it, or 0 if there is no such message.
0