EXHIBIT NO. 99.(i) 2

LEGAL OPINION CONSENT

I consent to the incorporation by reference in this Post-Effective Amendment No. 79 to the Registration Statement (the “Registration Statement”) of MFS® Series Trust XII (the “Trust”) (File Nos. 333-126328 and 811-21780), of my opinion dated May 18, 2026, appearing in Post-Effective Amendment No. 78 to the Trust’s Registration Statement, which was filed with the Securities and Exchange Commission on May 18, 2026.

 /s/BRIAN E. LANGENFELD 

 Brian E. Langenfeld

 Vice President and Managing Counsel

Boston, Massachusetts

August 27, 2026