• The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Interesting email issue - In need of assistance

C

criticman

Guest
Alright, spammer got in, took care of that issue.

Failure notices galore in one inbox.

Attempting to login to webmail fails, and all IMAP and POP3 attempts timeout (we're talking nearly 200,000 messages in this box).

So, is there a command line way to delete messages containing "failure notice" in them? I know where the mailbox is in terms of the qmail mailname Maildir. I am just blanking on the command to locate messages with "failure notice" in them and automatically delete messages it matches.

I believe there are some important messages among the junk and need to be able to find them - so a complete deletion of the Maildir file contents using find -type f....etc will not be sufficient.

Thanks!
 
Below is a script that should do the job. You would execute it was follows:

./rm-maildir-messages.pl /var/qmail/mailnames/xyz.com/sales/Maildir "^Subject: failure notice$"

Code:
#!/usr/bin/perl

use strict;
use FileHandle;

my ($Maildir) = $ARGV[0] || die "Maildir not provided.\n";
my ($regexp) = qr/$ARGV[1]/;

MAIN:
{
   my ($subdir);

   unless (scalar @ARGV == 2)
   {
      die "$0 <maildir> <regexp>\n";
   }

   for $subdir ('cur', 'new')
   {
      clean_maildir ($Maildir . '/' . $subdir);
   }
};

sub clean_maildir
{
   my ($dirname) = @_;
   my ($dh) = new FileHandle();
   my ($file);

   opendir ($dh, $dirname) or die $!;

   while ($file = readdir ($dh))
   {
      next unless (-f $dirname . '/' . $file);

      my ($fh) = new FileHandle();
      next unless ($fh->open ($dirname . '/' . $file));

      while (<$fh>)
      {
         s/[\r\n]+$//;
         if ($_ =~ $regexp)
         {
#            printf "%s/%s\n", $dirname, $file;
            unlink ($dirname . '/' . $file);
         }
      }

      $fh->close();
   }

   closedir ($dh);
}
 
Back
Top