On 2013-03-01 1:06 PM, Christian Boltz <pos...@cb...> wrote:
> sorry for not replying earlier - I was busy with too many other things.
> At least one of them was PostfixAdmin - the old edit-...php and
> create-...php files are finally gone (replaced by *Handler classes). Now
> up to the TODOs and the CLI ;-) (add in interactive mode already works
> with the *Handler classes)
No problem at all Christian... I'm really looking forward to the 3.x
release too! :)
> Am Montag, 25. Februar 2013 schrieb Tanstaafl:
>> Thanks very much Rudi. Change applied, but only time will tell.
>
> There might be another issue, independent from your regex.
>
> My guess is that there's another (els)if condition that matches before
> your regex even has a chance to get checked.
>
> To check that, please post some more lines. To be exact: I'd like to
> see the complete code block starting from (around line 607)
> $logger->debug("Script argument SMTP recipient is : '$smtp_recipient' and smtp_sender : '$smtp_sender'");
> while (<STDIN>) {
> until (around line 630)
> else {$lastheader = '' ; }
> }
Ok, well, just to be thorough, I'm including everything in the 'Take
headers apart' section, including the line immediately following my new
line:
> # Take headers apart
> $cc = '';
> $replyto = '';
>
> $logger->debug("Script argument SMTP recipient is : '$smtp_recipient' and smtp_sender : '$smtp_sender'");
> while (<STDIN>) {
> last if (/^$/);
> if (/^\s+(.*)/ and $lastheader) { $$lastheader .= " $1"; next; }
> elsif (/^from:\s*(.*)\n$/i) { $from = $1; $lastheader = \$from; }
> elsif (/^to:\s*(.*)\n$/i) { $to = $1; $lastheader = \$to; }
> elsif (/^cc:\s*(.*)\n$/i) { $cc = $1; $lastheader = \$cc; }
> elsif (/^Reply\-to:\s*(.*)\s*\n$/i) { $replyto = $1; $lastheader = \$replyto; }
> elsif (/^subject:\s*(.*)\n$/i) { $subject = $1; $lastheader = \$subject; }
> elsif (/^message\-id:\s*(.*)\s*\n$/i) { $messageid = $1; $lastheader = \$messageid; }
> elsif (/^x\-spam\-(flag|status):\s+yes/i) { $logger->debug("x-spam-$1: yes found; exiting"); exit (0); }
> # new 'multi-string' line is for adding any string you want to test for in the from header, but be careful what you put in here
> elsif (/^from:.*(alerts|autoreply|bounce|do-not-reply|facebook|linkedin|list-|myspace|noreply|twitter).*/i) { $logger->debug("Multi-string From header matching $1 found; exiting"); exit (0); }
> elsif (/^x\-facebook\-notify:/i) { $logger->debug('Mail from facebook, ignoring'); exit(0); }
Many thanks for being willing to take a look at it.
Again, I'm hoping for a one-liner that tests for any of the strings in
both the mail-from and any other From headers.
My biggest problem is testing changes though... I basically need to wait
for someone to have their vacation enabled, and that gets emails from
some of these senders I want to not send vacation messages for.
Anyway, thanks again, and hopefully you'll either confirm that it maybe
should work now, or point out something else I should change.
Regards,
Charles
|