Have you ever received an iMessage from someone you don’t know and want to make sure that you only get notifications from your contacts? If you are running iOS 6 on your device, it’s easy to make it only show notification alerts from only people listed in your Contacts.
On your iPhone go to Settings >> Notifications.
Scroll down the list and tap Messages. Then scroll down and select My Contacts Only.
This will restrict any messages that comes from unknown senders. This also works for Photo and Game Center notifications.