In the male reproductive system of insects, the male accessory glands and ejaculatory duct (MAG/ED) are important organs and their primary function is to enhance the fertility of spermatozoa. Proteins secreted by the MAG/ED are also known to induce post-mating changes and immunity responses in the female insect. To understand the gene expression profile in the MAG/ED of the oriental fruit fly Bactrocera dorsalis (Hendel), that is an important pest in fruits, we performed an Illumina-based deep sequencing of mRNA. This yielded 54,577,630 clean reads corresponding to 4.91 Gb total nucleotides that were assembled and clustered to 30,669 unigenes (average 645 bp). Among them, 20,419 unigenes were functionally annotated to known proteins/peptides in Gene Orthology, Clusters of Orthologous Groups, Kyoto Encyclopedia of Genes and Genomes pathway databases. Typically, many genes were involved in immunity and these included microbial recognition proteins and antimicrobial peptides. Subsequently, the inducible expression of these immunity-related genes was confirmed by qRT-PCR analysis when insects were challenged with immunity-inducible factors, suggesting their function in guaranteeing fertilization success. Besides, we identified some important reproductive genes such as juvenile hormone- and ecdysteroid-related genes in this de novo assembly. In conclusion, this transcriptomic sequencing of B. dorsalis MAG/ED provides insights to facilitate further functional research of reproduction, immunity and molecular evolution of reproductive proteins in this important agricultural pest.