Read here about the reception of thermal information

Mammalian Thermoception

Thermoception is the sense of heat and the absence of heat (cold) by the skin and including internal skin passages, or rather, the heat flux (the rate of heat flow) in these areas. There are specialized receptors for cold (declining temperature) and to heat. The cold receptors play an important part in the dog's sense of smell, telling wind direction. The heat receptors are sensitive to infrared radiation and can occur in specialized organs for instance in pit vipers. The thermoceptors in the skin are quite different from the homeostatic thermoceptors in the brain (hypothalamus) which provide feedback on internal body temperature.

Pain and Temperature Touch

The pain and temperature system does not have specialized receptor organs. Instead, it uses free nerve endings throughout skin, muscle, bone, and connective tissue to perceive changes in temperature and pain peptides. Although pain will result from damage to a free nerve ending, in reality most pain is a result of substances released by damaged tissues: prostaglandins, histamine, and substance P. The free nerve ending has receptors for these substances and lets you know (stridently) when tissue has been damaged.