When your finger gets accidently caught at the door, the pain message is sent to your brain through:
Sensory Neurons
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.
As the name suggests, sensory neurons are associated with the conduction of sensory impulses. The impulses that are generated in the sensory organs (like eyes, nose, tongue, or skin) are conducted to the CNS via these cells. In short, these neurons convert external sensory stimuli like touch, pain, sense of heat, smell, as well as visual and auditory inputs into an internal electrical impulse.