AI needs a formal functional theory of emotions to represent in computer programs our knowledge of emotions. In the theory we propose, emotions are a special class of Intentional states with structural components and properties similar to those of the traditional somatic appetites of thirst, hunger, and sex. These were originally part of a hardwired, phylogenetically adapted, nonverbal feedback system for implicitly conveying information about these states both among and within individual members of the species. A classification system provides two major functional classes of emotions, (1) those serving as Appetitive Wishes toward objects, and (2) those serving as Beliefs about the status of fulfillment of those and other significant wishes. Thus, emotions such as Anger or Fear indicate a wish to attack or escape from some object or situation, while Love or Surprise indicate wishes to care about or explore an object or situation. Emotional wishes, like their somatic brethren, require Consummatory Acts for their fulfillment. The result of these acts are emotions such Anxiety or Depression, which indicate Beliefs that the relevant wishes will be hard or impossible to satisfy, or Contentment or Elation, which function as Beliefs that the wishes have been or are being fulfilled. Together, emotional wishes and beliefs form a comprehensive wish-belief information feedback system with manifold causal consequences. Potential applications include agent-oriented problem solving, animation, and human-computer interaction.