People express emotions as part of everyday communication. Emotions can be judged by a combination of cues such as facial expressions, prosodies, gestures, and actions. Emotions are also articulated by written texts. Inspired by works in sentiment analysis, this thesis explores approaches to automatic detection of emotions in text. I draw from emotion theories in the fields of psychology and linguistics, and use natural language processing and machine learning techniques for automatic emotion detection. In this thesis, I describe studies and experiments in manual and automatic recognition of expressions of the six basic emotions (Ekman, 1992 - happiness, sadness, anger, disgust, surprise, and fear - in text form. The text under study comprises data collected from blogs, representing texts rich in emotion content and therefore suitable for this study. The first task I consider is to prepare a corpus annotated with emotion-related information. The annotations include emotion category out of the aforementioned six; emotion intensity at one of the four levels - high, medium, low, and neutral; and spans of text indicating emotion expressions within sentences. To measure consensus amongst human judges on annotation and to gauge the complexity of the task under investigation, an inter-annotator agreement study is also performed. In my work, I investigate features that can help differentiate emotion from non-emotion. A combination of lexical and semantic features is used to train classifiers for emotion/non-emotion classification. I describe the techniques implemented for discerning the six basic emotion categories. I use a knowledge-based approach for this task based on semantic resources - WordNet-Affect and Roget's Thesaurus. This approach provides results that significantly surpass the baseline term-counting method. For emotion intensity recognition, I use corpus-based syntactic bigrams to improve the performance of a baseline system that only uses unigrams as features.