490 |
} |
} |
491 |
} |
} |
492 |
|
|
493 |
warn "can't find hash in e-mail $to\n" unless ($hash); |
#warn "can't find hash in e-mail $to\n" unless ($hash); |
494 |
|
|
495 |
my $sent = $self->{'loader'}->find_class('sent'); |
my $sent = $self->{'loader'}->find_class('sent'); |
496 |
|
|
497 |
# will use null if no matching message_id is found |
# will use null if no matching message_id is found |
498 |
my $sent_msg = $sent->search( hash => $hash )->first; |
my $sent_msg; |
499 |
|
$sent_msg = $sent->search( hash => $hash )->first if ($hash); |
500 |
|
|
501 |
my ($message_id, $user_id) = (undef, undef); # init with NULL |
my ($message_id, $user_id) = (undef, undef); # init with NULL |
502 |
|
|
504 |
$message_id = $sent_msg->message_id || carp "no message_id"; |
$message_id = $sent_msg->message_id || carp "no message_id"; |
505 |
$user_id = $sent_msg->user_id || carp "no user_id"; |
$user_id = $sent_msg->user_id || carp "no user_id"; |
506 |
} else { |
} else { |
507 |
warn "can't find sender with hash $hash\n"; |
#warn "can't find sender with hash $hash\n"; |
508 |
|
my $users = $self->{'loader'}->find_class('users'); |
509 |
|
my $from = $m->header('From'); |
510 |
|
$from = $1 if ($from =~ m/<(.*)>/); |
511 |
|
my $this_user = $users->search( email => $from )->first; |
512 |
|
$user_id = $this_user->id if ($this_user); |
513 |
} |
} |
514 |
|
|
515 |
|
|
520 |
my $bounce = eval { Mail::DeliveryStatus::BounceParser->new( |
my $bounce = eval { Mail::DeliveryStatus::BounceParser->new( |
521 |
$arg->{'message'}, { report_non_bounces=>1 }, |
$arg->{'message'}, { report_non_bounces=>1 }, |
522 |
) }; |
) }; |
523 |
warn "can't check if this message is bounce!" if ($@); |
#warn "can't check if this message is bounce!" if ($@); |
524 |
|
|
525 |
$is_bounce++ if ($bounce && $bounce->is_bounce); |
$is_bounce++ if ($bounce && $bounce->is_bounce); |
526 |
} |
} |