How to Delete Exim Email For A Particular User From Mail Server Queue

Q. I’m using Fedora 7 server with exim pre installed by someone else. How do I delete email for a particular user from exim queue (like

A. Exim is a mail transfer agent (MTA) used on Unix-like operating systems. It is freely available under the GNU GPL and it aims to be a general and flexible mailer with extensive facilities for checking incoming e-mail.

Task: Delete Mail Linux Exim Server

To delete email for a particular user use shell pipes. By default the exim mail queue is located at /var/spool/exim/input directory. To delete email for a particular user called, enter:
# exiqgrep -ir | xargs exim -Mrm
# exiqgrep -ir | xargs exim -Mrm

Updated for accuracy.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 7 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
7 comments… add one
  • D Mar 15, 2008 @ 4:23

    wow, manually deleting the files from the spool can lead to issues…

    exim has tools for these kind of tasks (exiqgrep for instance).

    here’s what i would use to remove all messages addressed to an email address:

    #exiqgrep -ir | xargs exim -Mrm

  • 🐧 nixCraft Mar 17, 2008 @ 18:23

    Thanks, the faq has been updated.

  • sharma Oct 21, 2008 @ 3:36

    hi Good morning sir
    i have one doubt sir,
    we are using ubuntu mail server sir
    please help me ,my problem is how to delete perticular mail in all users account from server,
    what is the command,
    one spam mail coming from other side so that mail iwant to delete from all users account

    please reply sir

  • adhitya cn Apr 16, 2009 @ 8:13

    great article from nixcraft [as usual]…

  • KJ May 21, 2009 @ 8:21

    Thanks for this, very useful after a user opted to get an email for a cron running every minute, which caused their Yahoo mail account to reject the messages and pile up in the queue!

  • sandeep May 7, 2014 @ 9:39

    I want to delete mails in the queue related to particular domain how do we do that.

  • Marcelo May 22, 2015 @ 3:56

    for removel all mails SENT from
    exiqgrep -if | xargs exim -Mrm

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum