tested and polished email notification, tweaks for missing apache_header function