Mesalazine (MSZ) suppositories are a first-line medication for the localized treatment of ulcerative colitis (UC). However, the frequent defecation of patients with UC influences the retention of the suppository in the rectum and multiple doses have to be applied. Here, a mesalazine hollow suppository (MHS) is developed using three-dimensional (3D) printing. The MHS is composed of an inner supporting spring and an outer MSZ-loaded curved hollow shell. Springs were prepared using fused deposition modeling (FDM) 3D printing with thermoplastic urethane filaments, followed by splitting. The optimal parameters, including elasticity, filament diameter, spring inner diameter, and filament distance, were screened. The shell was prepared by FDM 3D printing utilizing MSZ, polyvinyl alcohol, and polyethylene glycol, which were assembled with springs to obtain FDM 3D-printed MHS (F-MHS); if 3D-printed metal molding was used in preparing shell, mold-formed MHS (M-MHS) was obtained. The F-MHS exhibited faster MSZ release than the M-MHS; therefore, the molding method is preferable. The inserted M-MHS was retained in the rat rectum for 5 h without affecting defecation. M-MHS alleviated tissue damage of UC rats and reduced inflammation with low levels of myeloperoxidase and proinflammatory cytokines. Personalized MHS is a promising medication for the localized treatment of UC.