How to check Postfix’s email queue and delete it .


Cheap reseller Hosting


postfix1

On this post you can check the messages in the postfix queue.

 

1- Postfix maintains two queues, the pending mails queue, and the deferred mail queue,
the differed mail queue has the mail that has soft-fail and should be retried (Temporary failure),
Postfix retries the deferred queue on set intervals (configurable, and by default 5 minutes)

 

1- Display a list of queued mail, deferred and pending

mailq

or

postqueue -p

To save the output to a text file you can run

mailq > mail.txt

or

postqueue -p > mail.txt

the above commands display all queued messages (Not the message itself but the sender and recipients and ID), The ID is particularly useful if you want to inspect the message itself.

2- View message (contents, header and body) in Postfix queue

Assuming the message has the ID XXXXXXX (you can see the ID form the QUEUE)

postcat -vq XXXXXXXXXX

Or to save it in a file

postcat -vq XXXXXXXXXX > themessage.txt

3- Tell Postfix to process the Queue now

postqueue -f

OR

postfix flush

4- Delete queued mail

Delete all queued mail

postsuper -d ALL

Delete differed mail queue messages

(The ones the system intends to retry later)

postsuper -d ALL deferred

Delete from queue selectively

To delete from the queue all emails that have a certain address in them, we can use this program (perl script)…

NOTE: This perl script seems to be free, and is all over the internet, i could not find out where it originates or who wrote it.

1- Download this file, unzip, and upload the file to your server, then from your bash command line, Change Directory to wherever you uploaded this file, for example cd /root (Just an example, You can upload it wherever you wish)

NOTE: A second script here works differently, i have not yet tested it, download it here

Now, from within that directory, execute…

./postfix-queue-delete.pl ashish@ashishkale.in

Any mail that has this email address in it’s IN or OUT list will be deleted

The script uses the postqueue -p then looks for your string, once found, it deletes the email by ID, this means that this script can delete messages using any text that appears when you run mailq (or postqueue -p), so if you run it with the parameter joe all mail with addresses such as joefriend@example.com and

Other moethods exist, like executing directly

mailq | tail +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "email@address.com" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -

——————————–

Sample Messages in a differed mail queue

——————————–

SOME282672ID 63974 Mon Nov 29 05:12:30 someaddresss@yahoo.com
(temporary failure. Command output: maildrop: maildir over quota.)
localuser@exmple.com

———————————-

SOME282672ID 9440 Wed Jun 30 05:30:11 MAILER-DAEMON
(SomeHostName [xxx.xxx.xxx.xxx] said: 452 <username@example.org> Mailbox size limit exceeded (in reply to RCPT TO command))
username@example.org

———————————-

SOME282672ID 4171 Thu Nov 25 13:22:03 MAILER-DAEMON
(host inbound.somedomain.net [yyy.yyy.yyy.yyy] refused to talk to me: 550 Rejected: 188.xx.179.46, listed at http://csi.cloudmark.com/reset-request for remediation.)
someuser@example.com

———————————

SOME282672ID 37031 Thu Nov 25 08:53:36 someuser@example.net
(Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
someuser@example.com 

Cheap web Hosting


Useful Exim Commands


Cheap reseller Hosting


Useful Exim Commands

 

Exim is a message transfer agent (MTA) for hosts that are highly comfortable and running in Unix or Linux Operating system. Exim server is developed at the University of Cambridge. We can easily manage and configure in server. In this article i will explain few executable commands as below.

 

1) Print a count of the messages in the queue, use the following command line : 

root@localhost# exim -bpc

 

2) Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient), use the following command line : 

root@localhost# exim -bp

 

3) Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals), use the following command line : 

root@localhost# exim -bp | exiqsumm

 

4) Print what Exim is doing right now, use the following command line : 

root@localhost# exiwhat

 

5) Test how exim will route a given address, use the following command line : 

root@localhost# exim -bt test@ownmyserver.com
user@thishost.com
<– test@ownmyserver.com
router = localuser, transport = local_delivery
root@localhost# exim -bt user@thishost.com
user@thishost.com
router = localuser, transport = local_delivery
root@localhost# exim -bt user@remotehost.com
router = lookuphost, transport = remote_smtp
host mail.remotehost.com [1.2.3.4] MX=0

 

6) Run a pretend SMTP transaction from the command line, as if it were coming from the given IP address. This will display Exim’s checks, ACLs, and filters as they are applied. The message will NOT actually be delivered, use the following command line : 

root@localhost# exim -bh 192.168.11.22

 

7) Display all of Exim’s configuration settings, use the following command line : 

root@localhost# exim -bP

 

 

 

 

exim-vps


Cheap web Hosting


Basic UNIX Commands


Cheap reseller Hosting


UNIX

 

 

Basic UNIX Commands

 

  • Essential  UNIX Commands

These commands that you really need to know in order to get started with UNIX. They are probably similar to commands you already know for another operating system.

     Command                       Example                                       Description
1.     ls ls
ls -alF
Lists files in current directory
List in long format
2.     cd cd tempdir
cd ..
cd ~dhyatt/web-docs
Change directory to tempdir
Move back one directory
Move into dhyatt’s web-docs directory
3.   mkdir mkdir graphics Make a directory called graphics
4.    rmdir rmdir emptydir Remove directory (must be empty)
5.     cp cp file1 web-docs
cp file1 file1.bak
Copy file into directory
Make backup of file1
6.     rm rm file1.bak
rm *.tmp
Remove or delete file
Remove all file
7.     mv mv old.html new.html Move or rename files
8.     more more index.html Look at file, one page at a time
9.     lpr lpr index.html Send file to printer
10.   man man ls Online manual (help) about command
  • Valuable UNIX Commands

Once you have mastered the basic UNIX commands, these will be quite valuable in managing your own account.

             Command               Example                              Description
1.     grep <str><files> grep “bad word” * Find which files contain a certain word
2.     chmod <opt> <file> chmod 644 *.html
chmod 755 file.exe
Change file permissions read only
Change file permissions to executable
3.     passwd passwd Change passwd
4.     ps <opt> ps aux
ps aux   |   grep dhyatt
List all running processes by #ID
List process #ID’s running by dhyatt
5.     kill <opt> <ID> kill -9 8453 Kill process with ID #8453
6.     gcc (g++) <source> gcc file.c -o file
g++ fil2.cpp -o fil2
Compile a program written in C
Compile a program written in C++
7.     gzip <file> gzip bigfile
gunzip bigfile.gz
Compress file
Uncompress file
8.     mail
(pine)
mail support@hostripples.com < file1
pine
Send file1 by email to someone
Read mail using pine
9.     telnet <host>
ssh <host>
telnet vortex.hostripples.com
ssh -l dhyatt jazz.hostripples.com
Open a connection to vortex
Open a secure connection to jazz as user dhyatt
10.   ftp <host>
ncftp <host/directory>
ftp station1.hostripples.com
ncftp metalab.hostripples.com
Upload or Download files to station1
Connect to archives at UNC
  • Fun UNIX Commands

These commands that you might find interesting or amusing. They are actually quite helpful at times, and should not be considered idle entertainment.

      Command       Example                                                    Description
1.     who who Lists who is logged on your machine
2.     finger finger Lists who is on computers in the lab
3.     ytalk <user@place> ytalk hostripples.com Talk online with dhyatt who is on threat
4.     history history Lists commands you’ve done recently
5.     fortune fortune Print random humerous message
6.     date date Print out current date
7.     cal <mo> <yr> cal 9 2000 Print calendar for September 2000
8.     xeyes xeyes & Keep track of cursor (in “background”)
9.     xcalc xcalc & Calculator (“background” process)
10.   mpage <opt> <file> mpage -8 file1   |  lpr Print 8 pages on a single sheet and send to printer (the font will be small!)
  • Helpful UNIX Commands

These commands are very helpful, especially with graphics and word processing type applications.

                        Command              Example                                    Description
1.     netscape netscape & Run Netscape browser
2.     xv xv & Run graphics file converter
3.     xfig / xpaint xfig & (xpaint &) Run drawing program
4.     gimp gimp & Run photoshop type program
5.     ispell <fname> ispell file1 Spell check file1
6.     latex <fname> latex file.tex Run LaTeX, a scientific document tool
7.     xemacs / pico xemacs (or pico) Different editors
8.     soffice soffice & Run StarOffice, a full word processor
9.     m-tools (mdir, mcopy,
mdel, mformat, etc. )
mdir a:
mcopy file1   a:
DOS commands from UNIX (dir A:)
Copy file1 to A:
10.   gnuplot gnuplot Plot data graphically

 

  • Useful UNIX Commands:

These commands are useful for monitoring system access, or simplifying your own environment.

          Command                  Example                                 Description
1.     df df See how much free disk space
2.     du du -b subdir Estimate disk usage of directory in Bytes
3.     alias alias lls=”ls -alF” Create new command “lls” for long format of ls
4.     xhost xhost + threat.hostripples.com
xhost –
Permit window to display from x-window program from threat
Allow no x-window access from other systems
5.     fold fold -s file1   |   lpr Fold or break long lines at 60 characters and send to printer
6.     tar tar -cf subdir.tar subdir
tar -xvf subdir.tar
Create an archive called subdir.tar of a directory
Extract files from an archive file
7.     ghostview (gv) gv filename.ps View a Postscript file
8.     ping
(traceroute)
ping threat.hostripples.com
traceroute www.hostripples.com
See if machine is alive
Print data path to a machine
9.     top top Print system usage and top resource hogs
10.   logout (exit) logout or exit How to quit a UNIX shell.

 


Cheap web Hosting