sub EmailNotify {
local $/ = "\n"; # don't slurp whole files in this sub.
if ($EmailNotify) {
my ($id, $user) = @_;
if ($user) {
$user = " by $user";
}
my $address;
open(EMAIL, "$DataDir/emails")
or die "Can't open $DataDir/emails: $!\n";
Fix:
if(!-e "$DataDir/emails"){ return;}before the open statement.