The melanization reaction is a rapid and important immune mechanism in arthropods. It results in the production of melanin at the site of injury and around invading microbes. The enzymes responsible for melanogenesis are phenoloxidases (PO), which catalyze the oxidation of phenols to quinones, which then polymerize into melanin. A by-product of melanogenesis are cytotoxic compounds that can pose a threat to the host organism itself due to their unspecific effects. Melanogenesis is therefore tightly regulated: POs are produced in an inactive form as prophenoloxidases (PPOs), which get activated by the sequential cleavage of an extracellular serine protease (SP) cascade. The aims of this PhD thesis were to better understand the melanization reaction in Drosophila melanogaster, at both the effector and the regulation levels. D. melanogaster has three PPO genes. We generated for the first time a mutant for the third PPO gene, PPO3, and analyzed its function. We demonstrated that PPO3 has an important role in the melanotic encapsulation reaction, a defense mechanism against parasitization. Additionally, we extended our knowledge about the other PPOs, PPO1 and PPO2. We confirmed their role in the defense against septic infections and ascribed a new role for PPO2 in the melanotic encapsulation. The use of single or combined mutations allowed us to show that each PPO mutant has a specific phenotype, and that knocking out two of three genes is required to abolish a particular function completely. Thus, Drosophila PPOs have partially overlapping functions to optimize melanization. Finally, we demonstrated that PPO3 is the result of a gene duplication of PPO2, restricted to a subgroup of Drosophila, and likely evolved as an additional defense mechanism in the cellular encapsulation process, probably due to the evolutionary pressure from parasitoid wasps. In the second part of this thesis, we re-addressed the roles and functions of three SPs involved in the melanization process. We developed a novel screening method for defects in melanization by infecting flies with a low-dose of S. aureus. We found that only one of the three SPs, Sp7, is involved in survival upon septic infections. Additionally, we demonstrated that the melanization reaction resulting in the clearance of systemic infections is regulated by extracellular components of the Toll pathway. While a connection between the SPs regulating the melanization and the Toll pathway was found in other insects, our study provides the first demonstration in D. melanogaster. We also present evidence of a disconnect between the melanin production at wound sites and the melanization reaction resulting in the clearance of infections, indicating a role of cytotoxic compounds in the killing of microbes. Finally, we ascribed a new role to Hayan, another SP implicated in melanization. Hayan is dispensable for the clearance of septic infections, but is important for wound melanization. We also demonstrated that Hayan plays an important role in the activation of the Toll pathway. Hayan, together with the SP Persephone, is necessary to activate Toll after infection. We propose that both Hayan and Persephone are the result of a recent gene duplication event. This can explain why they still have overlapping functions, but these genes also show signs of early sub-functionalization. Collectively, our work provides important insights on both melanization and the activation of the Toll pathway.