If you find yourself getting a lot of random iMessages from strangers, a new feature in iOS 8.3, released earlier today, allows you to easily filter these out of your main Messages list and block notifications from them.

You can enable or disable this feature with a quick trip into the Messages section of your iOS Settings app. Simply look for the “Filter Unknown Senders” option and toggle it on. Once enabled, go into your Messages app and swipe downward to see the selection buttons for “Contacts & SMS” and “Unknown Senders.”
Keep in mind that, as the button labels imply, this feature only works for iMessages from unknown senders — those not in your Contacts list. SMS messages will still be shown in the main “Contacts & SMS” view, regardless of whether they were sent by a known sender or not. Should you decide that you’d simply rather have everything back in one list, you can toggle this feature back off again by going back into Settings, Messages to return to the pre-iOS 8.3 behavior.