a, b Two mutant alleles of Gr32a, Gr32aΔ(a), and Gr32aKO(b), failed to show the increase defense after mating. n = 8 for each group in (a), n = 8, 8, 16 and 17 (from left to right) in (b). ***p < 0.001, *p < 0.05, p > 0.05 (n.s.), two-tailed unpaired t tests. c Silencing Gr32a neurons with Kir2.1 eliminated the mating-induced elevation of defensive response. n = 9, 8, 8, 8, 9, and 9 (from left to right). **p < 0.01, *p < 0.05, p > 0.05 (n.s.), two-tailed unpaired t tests. d Co-expression of PPK (red) and Gr32a (green) in female reproductive tract. Scale bar represented 50 μm. Right: the cell bodies of PPK (red) and Gr32a (green) on uterus were enlarged. SR indicated seminal receptacle. Scale bar represented 20 μm. e Immunofluorescence of Gr32a (red) in the central nervous system. White arrow indicated projections of Gr32a neurons on the uterus. Blue: nc82. Scale bar represented 50 μm. f Immunofluorescence of UNs (red). The expression of Gr32a in chemoreceptors on other appendages was eliminated by intersection strategy of indicated genotype. White arrow indicated projections of Gr32a UNs. Right panel: projections of UNs in the Abg. Blue: nc82. Scale bar represented 50 μm. g Schematic showed that the cell bodies of UNs. These UNs projected to the abdominal ganglion of the VNC (green). h, i Silencing UNs h blocked the post-mating enhancement of defensive response, while activating them i elevated defensive response in decapitated virgins. n = 12, 8, 13, 6, 8, 10 (from left to right) in (h), n = 10, 13, 8 for each group in (i). ***p < 0.001, *p < 0.05, p > 0.05 (n.s.), two-tailed unpaired t tests. j Activation of UNs in virgin females decreased the courtship successful rates, and these virgins were paired with naïve Canton S male. n = 14, 20 and 17 for each group. *p < 0.03, two-tailed Fisher’s exact test. Error bars indicate mean ± SEM, n.s., not significant. Source data are provided as a Source Data file.