Block Contact on iPhone
Just like getting phone calls from unwanted callers, you can receive text messages from unwanted senders. Whether it’s an unknown person, you believe it’s spam, or is simply someone you no longer want texts from, you can block them easily.

Block text message senders

To get started, open your Messages app, then follow these steps.
1) Tap the text message with the sender that you want to block.
2) Tap the information icon at the top right of the message.
Tap Info to Block Sender
3) Tap the number that the message came from and be careful not to tap the phone or FaceTime icon if you see one because this will call them.
4) Tap Block this Caller at the bottom of the screen.
5) Confirm the action by tapping Block Contact in the pop-up window.
Block iPhone text messages from a certain Sender
You will see the Block this Caller option now display as Unblock this Caller. You can then tap the arrow at the top left to go back and tap Done.
If the sender tries to text you after you block them, their message will not come through to you.

See who you have blocked

If you ever want to see a list of numbers you have blocked, follow these steps.
1) Open the Settings app.
2) Tap Messages.
3) Scroll down and tap Blocked.
View Blocked Senders
You will then see all of the numbers you have blocked. You can edit the list by tapping Edit at the top or select one to display their details and other options.