Postfix: flush emails from the mail queue

Problem:

The customer was getting a lot system alerts even after disabling it. There were a lot of emails in the queue:

# mailq
-Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------
DB13ED78461   21597 Thu May 26 05:39:26  flashgrid@localhost.localdomain
(delivery temporarily suspended: connect to us-smtp-inbound-2.meme.com[~]:25: Connection timed out)
                                         alertdb@test.com

DA31AD9C4B5   21503 Thu May 26 10:32:16  flashgrid@localhost.localdomain
(delivery temporarily suspended: connect to us-smtp-inbound-2.meme.com[~]:25: Connection timed out)
                                         alertdb@test.com

DA701D9AC16   21601 Thu May 26 07:01:06  flashgrid@localhost.localdomain
(delivery temporarily suspended: connect to us-smtp-inbound-1.meme.com[~]:25: Connection timed out)
                                         alertdb@test.com

DA3B9D9C488   21503 Thu May 26 09:31:36  flashgrid@localhost.localdomain
(connect to us-smtp-inbound-1.meme.com[~]:25: Connection timed out)
                                         alertdb@test.com

[...]

Solution:

  • To remove all mail from all the queues ( hold, incoming, active and deferred ) , run :
# postsuper -d ALL
  • To remove all mails in the deferred queue only, run :
# postsuper -d ALL deferred
Advertisement

Setup netbackup to send mails

1. Installing and configuring BLAT 1.1 Download BLAT from here  http://sourceforge.net/projects/blat/ 1.2 Extract files, copy blat.exe and paste it into C:\Windows\System32 (indicate the correct path for your System32). 1.3 From the command line run the following:

> cd C:\Windows\System32
> blat -install <email server addr> <sender's addr>

Note: <sender’s addr> is the valid email account, which will be the primary sender of the email notifications. Example:

> blat -install mailserver.company.ge useraccount@company.ge

1.4 Testing the installation validity. Create a text file, for example, C:\textfile.txt with some text into it. And run the following from command line:

> blat C:\textfile.txt –s some_subject –to useraccount@company.ge

If blat is working,  useraccount@company.ge account should receive the mail. 2. Configuring nbmail.cmd script. 2.1 This script should be located in <install_path>\Veritas\NetBackup\bin , if not , go to the <install_path>\Veritas\NetBackup\bin\goodies and copy nbmail.cmd to <install_path>\Veritas\NetBackup\bin and then modify the script by the following way: For NetBackup 4.5 and 5.x systems find the following:

@rem @blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG –q

For NetBackup 6.0 or 7.0 systems find the following:

@REM @IF "%~4"=="" (
@REM blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG –q
@REM ) ELSE (
@REM blat %3 -s %2 -t %1 -i NetBackup -server WARTHOG -q -attach %4
@REM )

2.2 Remove all “@REM”. 2.3 Replace “WARTHOG” with the mail server name: For NetBackup 4.5 and 5.x systems find the following:

@rem @blat %3 -s %2 -t %1 -i NetBackup -server mailserver.company.ge –q

For NetBackup 6.0 or 7.0 systems find the following:

@REM @IF "%~4"=="" (
@REM blat %3 -s %2 -t %1 -i NetBackup -server mailserver.company.ge –q
@REM ) ELSE (
@REM blat %3 -s %2 -t %1 -i NetBackup -server mailserver.company.ge -q -attach %4
@REM )

3 Configure Netbackup to send mails to recipients.

3.1 Open Netbackup Administration Console We will use Master Servers and/or Clients properties under “NetBackup Management”-> “Host Properties”.

1. If you want NetBackup to send notification just  about Failed backups, do the following(just):

1.1 Write the mail address(or addresses, separated by commas) to where email notification should be sent  into “Master Servers” –> Properties –> “Global Attributes“->”Administrator email address“(It will cause Symantec to send mails about backups that ended with non-zero status)

2.  If you want to receive notifications about Failed and Successful backups as well, do the following:

2.1 Write the mail address(or addresses, separated by commas) to where email notification should be sent  into “Master Servers” –> Properties –> “Universal Settings” –> “Client Administrator’s email

and  check  “Server sends mail”(means server where netbackup is installed will send) or “Client sends mail”(if client, that is backed up, can send mails)….I prefer to check  “Server sends mail”.

2.2  Under  “Clients“->Properties –> “Universal Settings” check “Server sends mail”(if you’ve checked it in “Master Servers” –> Properties –> “Universal Settings”) or “Client sends mail”(if you’ve checked it in “Master Servers” –> Properties –> “Universal Settings”). So do the same for clients as you did  for master server, or it will fail.

and  in “Client Administrator’s email” write the mail address(or addresses, separated by commas) to where email notification should be sent.

That is all.