--- trunk/Nos.pm 2005/05/24 14:02:05 47 +++ trunk/Nos.pm 2005/05/24 15:19:44 48 @@ -400,16 +400,19 @@ my $hash = $auth->generate_hash( $to_email ); my $from_addr; - my $from_email_only = $from . "+" . $hash . ( $domain ? '@' . $domain : ''); + my $email_hash = "+" . $hash . ( $domain ? '@' . $domain : ''); + my $from_email_only = $from . $email_hash; + my $from_bounce = $from . '-bounce' . $email_hash; + $from_addr .= '"' . $u->list_id->from_addr . '" ' if ($u->list_id->from_addr); $from_addr .= '<' . $from_email_only . '>'; my $to = '"' . $u->user_id->name . '" <' . $to_email . '>'; my $m_obj = Email::Simple->new($msg) || croak "can't parse message"; - $m_obj->header_set('Return-Path', $from_email_only) || croak "can't set Return-Path: header"; - $m_obj->header_set('Sender', $from_email_only) || croak "can't set Return-Path: header"; - $m_obj->header_set('Errors-To', $from_email_only) || croak "can't set Return-Path: header"; + $m_obj->header_set('Return-Path', $from_bounce) || croak "can't set Return-Path: header"; + $m_obj->header_set('Sender', $from_bounce) || croak "can't set Sender: header"; + $m_obj->header_set('Errors-To', $from_bounce) || croak "can't set Errors-To: header"; $m_obj->header_set('From', $from_addr) || croak "can't set From: header"; $m_obj->header_set('To', $to) || croak "can't set To: header"; @@ -463,6 +466,8 @@ my $to = $m->header('To') || die "can't find To: address in incomming message\n"; + my $return_path = $m->header('Return-Path') || ''; + my @addrs = Email::Address->parse( $to ); die "can't parse To: $to address\n" unless (@addrs); @@ -478,7 +483,7 @@ } } - croak "can't find hash in e-mail $to\n" unless ($hash); + warn "can't find hash in e-mail $to\n" unless ($hash); my $sent = $self->{'loader'}->find_class('sent'); @@ -497,7 +502,7 @@ my $is_bounce = 0; - { + if ($arg->{'bounce'} || $return_path eq '<>' || $return_path eq '') { no warnings; my $bounce = eval { Mail::DeliveryStatus::BounceParser->new( $arg->{'message'}, { report_non_bounces=>1 },