Filter and block messages on iPhone
In the Messages app , you can filter messages from unknown senders and block unwanted messages.
Filter iMessage messages from unknown senders
Go to Settings
> Messages.
Turn on Filter Unknown Senders.
This turns off iMessage notifications from senders who aren’t in your contacts and sorts the messages into the Unknown Senders tab in the Messages list.
You canʼt open any links in a message from an unknown sender until you add the sender to your contacts or reply to the message. If the message is spam, tap Report Junk (below the message) to delete and send the message to Apple.
Block messages from a specific person or number
In a Messages conversation, tap the name or number at the top of the conversation, then tap
at the top right.
Tap the name or phone number to view the contact card.
Scroll down, then tap Block this Caller.
To view and manage your list of blocked phone numbers and contacts, go to Settings > Messages > Blocked Contacts. See the Apple Support article Block phone numbers, contacts, and emails on your iPhone, iPad, or iPod touch.