Fix headers being sent multiple times if mail() is called more than once