Exposure to air pollution is linked to an increased severity of mental illness, according to the most comprehensive study of its kind.