Delete email from queue

Delete emails from queue If you have an email that is not being send and you want to remove it from the spool queue:

as root:

#mailq

This command will give us a list of emails request.

Example:

[root@-- --]# mailq
		/var/spool/mqueue (3 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
p19HouGC017719       84 Wed Feb  9 11:50
                 (Deferred: Connection refused by mail.somewhere.xxx.)

p19HgMTg017374       84 Wed Feb  9 11:42
                 (Deferred: Connection refused by mail.somewhere.xxx.)

p19Hui1W018001       84 Wed Feb  9 11:56
                 (Deferred: Connection refused by mail.somewhere.xxx.)

		Total requests: 3

As we can see, we currently have 3 emails that are not being send.

Each email is store in:

/var/spool/mqueue
[root@-- --]# ll /var/spool/mqueue/
total 6
-rw-------. 1 root smmsp   84 feb  9 11:42 dfp19HgMTg017374
-rw-------. 1 root smmsp   84 feb  9 11:50 dfp19HouGC017719
-rw-------. 1 root smmsp   84 feb  9 11:56 dfp19Hui1W018001
-rw-------. 1 root smmsp  928 feb  9 13:22 qfp19HgMTg017374
-rw-------. 1 root smmsp  927 feb  9 13:22 qfp19HouGC017719
-rw-------. 1 root smmsp  928 feb  9 13:22 qfp19Hui1W018001

For each email, we have 2 files.

Example:

For the email with ID: p19HouGC017719, we have two files:

1. dfp19HouGC017719
2. qfp19HouGC017719

So we just need to delete these two files to cancel this email.

[root@-- --]#rm dfp19HouGC017719 qfp19HouGC017719

That’s it. We can recheck with mailq:

[root@-- --]# mailq
		/var/spool/mqueue (2 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
p19HgMTg017374       84 Wed Feb  9 11:42
                 (Deferred: Connection refused by mail.somewhere.xxx.)

p19Hui1W018001       84 Wed Feb  9 11:56
                 (Deferred: Connection refused by mail.somewhere.xxx.)

		Total requests: 2

Now our email is gone.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s