On 2013-03-12 5:06 PM, Tanstaafl <tan...@li...> wrote:
> On 2013-03-12 4:47 PM, Rudi Floren <rud...@go...> wrote:
>> Am Dienstag, 12. März 2013 21:45:18 schrieb Tanstaafl:
>>> Wait... are you saying that one-liner change takes the place of the
>>> other block of code?
>>>
>>> hmmmm......
>> should.
> Ok, thanks, I'll experiment in the morning...
Ok, a few issues/questions...
There is one typo for sure: line 599, $adress should be $address
Next...
Shouldn't
'$custom_noreply_pattern == 1'
actually be
'$custom_noreply == 1' ?
Also, I am naming my two options
$custom_noreply
and
$custom_noreply_pattern
It just seems more correct to me.
So, I now have this line as:
> ($custom_noreply == 1 && $address =~ /^.*($custom_noreply_pattern).*/i) ) {
So, assuming you accept my modified variable name for the pattern, is
this correct?
Next to last question...
Wouldn't it make more sense to adjust the defaults for the custom
pattern to include all of the values in the immediately prior two tests,
and change this to just the one test, instead of basically having three
separate tests (one to test the local part, the next to test the domain
part, and finally our new custom one to test the whole thing?
And if this is ultimately the desired goal, we could rename the
variables one last time, and end up with something like:
> if($address =~ /^(noreply|postmaster|mailer\-daemon|listserv|majordomo|owner\-|request\-|bounces\-)/i ||
> $address =~ /\-(owner|request|bounces)\@/i ) {
> # $address =~ /\-(owner|request|bounces)\@/i ||
1. only ONE new variable that contains all of the predetermined strings,
and just a comment explaining how to modify this variable to include new
strings or tweak existing ones or even remove them if they are causing
too many false positives:
# This is the list of strings that is checked against both the
# envelope sender and any/all From header addresses that, if
# matched, results in the vacation message not being sent.
our $noreply_pattern =
'bounce|do-not-reply|facebook|linkedin|list-|listserv|mailer\-daemon|majordomo|myspace|noreply|owner\-|\-(owner|request|bounces)|postmaster|request\-|twitter';
Then the new 'sub check_and_clean_from_address' function would be
something like:
> sub check_and_clean_from_address {
> my ($address) = @_;
> my $logger = get_logger();
>
> if($address =~ /^.*($noreply_pattern).*/i) ) {
> $logger->debug("sender $address contains $1 - will not send vacation message");
> exit(0);
> }
> $address = strip_address($address);
> if($address eq '') {
> $logger->error("Address $address is not valid; exiting");
> exit(0);
> }
> #$logger->debug("Address cleaned up to $address");
> return $address;
> }
And finally, last question...
What is the practical limit on the number of characters that can be
included in this variable?
So, before I enable these changes, what do you think? If this looks
correct, I'll enable it and test it live for the next few weeks on my
server...
Thanks again Rudi!
Charles
|