When you hurt yourself, the pain message is sent to your brain through sensory neurons.
Sensory Receptors
The pain message is sent to your brain via the sensory neurons from the sensory receptors. Sensory receptors are dendritic ends of the sensory neurons which receive special stimuli, like pain, in this case.