Email notifier keeps resetting to "undefined"