To stop receiving messages from unknown numbers, follow the steps given below.
Open the Settings app on your iPhone.
Scroll down and select “Unknown & Spam” under Message Filtering.
Enable “Filter Unknown Senders” on the next screen.
Since the feature relies on your address book to distinguish between knowns and unknowns, it can extract texts from people you know but aren’t on your contact list. Hence, saving the contact details of everyone you know becomes important. In case you’re missing a message, check the Unknown Senders folder. Here’s how:
Open the Messages app.
Tap Filters at the top right.
Select Unknown Senders.
Scroll down to see if the text landed there.
If someone you know has sent you a link, but you can’t open it, replying to the message will make the link work. Once you respond to an SMS or MMS message three times or add the number to your contacts, iOS will stop filtering out messages from that particular sender. Instead, their texts will then show up in the primary inbox.