| 1 | 1 | ▶ | use 5.014; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | package Mail::Qmail::Filter::RewriteFrom; | ||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '1.0'; | |||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Mo qw(coerce required); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | extends 'Mail::Qmail::Filter'; | |||||||||
| 10 | |||||||||||
| 11 | 1 | has from => required => 1; | |||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub filter { | ||||||||
|
Subroutine
filter: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 14 | 0 | my $self = shift; | |||||||||
| 15 | 0 | my $message = $self->message; | |||||||||
| 16 | 0 | my $header = $message->header; | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | if ( my $from = $header->get('From') ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | chomp $from; | |||||||||
| 20 | 0 | ▶ | if ( my $reply_to = $header->get('Reply-To') ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | chomp $reply_to; | |||||||||
| 22 | 0 | $self->debug( 'Reply-To already set', $reply_to ); | |||||||||
| 23 | } | ||||||||||
| 24 | else { | ||||||||||
| 25 | 0 | $header->replace( 'Reply-To' => $from ); | |||||||||
| 26 | 0 | $self->debug( 'set Reply-To to From', $from ); | |||||||||
| 27 | } | ||||||||||
| 28 | 0 | $header->replace( From => $self->from ); | |||||||||
| 29 | 0 | $self->debug( 'set RFC5322.From', $self->from ); | |||||||||
| 30 | 0 | $message->replace_header($header); | |||||||||
| 31 | } | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 1 | 1; | |||||||||
| 35 | |||||||||||
| 36 | __END__ | ||||||||||