There are many causes of neck pain including bad posture.
Maintaining a poor neck posture can aggravate the structures of the neck and cause pain. Another common cause of neck pain is neural tension and whiplash.
Relieving Neck Pain
Point your nose forwards, bend your neck, taking your left ear towards your left shoulder. You can increase the stretch by dropping your right shoulder and gently pulling your right arm down with the opposite hand. You should feel a stretch to the side of your neck, on the side you are pulling your arm. Repeat to the right, helping improve mobility to your neck.
Sit or stand up with good posture, looking straight ahead. Move your left ear towards your left shoulder and move your nose right, you will feel a stretch on the right side of your neck. Now repeat to the opposite side.