[#31009] Add a switch to turn mail sending on/off (Fix #1186)