520 |
if ($sent->search( message_id => $m->message_id, user_id => $u->user_id )) { |
if ($sent->search( message_id => $m->message_id, user_id => $u->user_id )) { |
521 |
print "SKIP $to_email message allready sent\n"; |
print "SKIP $to_email message allready sent\n"; |
522 |
} else { |
} else { |
523 |
print "=> $to_email\n"; |
print "=> $to_email "; |
524 |
|
|
525 |
my $secret = $m->list_id->name . " " . $u->user_id->email . " " . $m->message_id; |
my $secret = $m->list_id->name . " " . $u->user_id->email . " " . $m->message_id; |
526 |
my $auth = Email::Auth::AddressHash->new( $secret, $self->{'hash_len'} ); |
my $auth = Email::Auth::AddressHash->new( $secret, $self->{'hash_len'} ); |
546 |
$m_obj->header_set('X-Nos-Hash', $hash); |
$m_obj->header_set('X-Nos-Hash', $hash); |
547 |
|
|
548 |
# really send e-mail |
# really send e-mail |
549 |
|
my $sent_status; |
550 |
|
|
551 |
if (@email_send_options) { |
if (@email_send_options) { |
552 |
send $email_send_driver => $m_obj->as_string, @email_send_options; |
$sent_status = send $email_send_driver => $m_obj->as_string, @email_send_options; |
553 |
} else { |
} else { |
554 |
send $email_send_driver => $m_obj->as_string; |
$sent_status = send $email_send_driver => $m_obj->as_string; |
555 |
} |
} |
556 |
|
|
557 |
$sent->create({ |
croak "can't send e-mail: $sent_status\n\nOriginal e-mail follows:\n".$m_obj->as_string unless ($sent_status); |
558 |
message_id => $m->message_id, |
my @bad = @{ $sent_status->prop('bad') }; |
559 |
user_id => $u->user_id, |
croak "failed sending to ",join(",",@bad) if (@bad); |
560 |
hash => $hash, |
|
561 |
}); |
if ($sent_status) { |
562 |
$sent->dbi_commit; |
|
563 |
|
$sent->create({ |
564 |
|
message_id => $m->message_id, |
565 |
|
user_id => $u->user_id, |
566 |
|
hash => $hash, |
567 |
|
}); |
568 |
|
$sent->dbi_commit; |
569 |
|
|
570 |
|
print " - $sent_status\n"; |
571 |
|
|
572 |
|
} else { |
573 |
|
warn "ERROR: $sent_status\n"; |
574 |
|
} |
575 |
|
|
576 |
if ($sleep) { |
if ($sleep) { |
577 |
warn "sleeping $sleep seconds\n"; |
warn "sleeping $sleep seconds\n"; |