Generate a configuration profile for Mail and Wi-Fi (ains-wifi).
This will download a .mobileconfig file containing both Mail and Wi-Fi settings. Install it in your device settings.