A glassy carbon electrode (GCE) was modified with a thin layer of multiwalled carbon nanotubes (MWCNTs) and subsequently, electrochemically deposited poly‐pyrrole. The electrochemical behavior of mesalazine was studied on the surface of the modified electrode by applying linear sweep voltammetry (LSV). The electropolymerization process and the electrochemical response toward mesalazine were investigated in the presence of different aromatic anion dopants including, benzenesulfonic acid (BSA), 1,3‐benzenedisulfonic acid (1,3‐BDSA), 1,5‐naphthalenedisulfonic acid (1,5‐NDSA) and new coccine (NC). By using 1,5‐NDSA as dopant, a significant increase (∼418 times) in the peak current of mesalazine was observed, in comparison to the bare GCE. Experimental variables such as drop size of the cast MWCNTs suspension, pH of the supporting electrolyte, accumulation conditions and the number of scans in the electropolymerization process were optimized by monitoring the LSV responses of mesalazine. Under the optimum conditions, two linear dynamic ranges of 0.01–0.1 µmol L−1 and 0.1–1.0 µmol L−1 with a detection limit of 3 nmol L−1 were resulted for the voltammetric determination of mesalazine. The prepared electrode showed high sensitivity, stability and good reproducibility for determination of mesalazine. These properties made the prepared sensor suitable for the determination of mesalazine in pharmaceutical and clinical preparations.