• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mailq Command Examples in Linux

by admin

The mailq command lists any outgoing email messages awaiting delivery:

# mailq
Queue ID- --Size-- ----Arrival Time--  -Sender/Recipient--
46AAB43972*    333 Tue Jan 10 21:17:14 smith@example.com
                                       jones@elsewhere.org

Sent mail messages are also recorded in a log file, /var/log/mail.log.

mailq Command Examples

1. To see the mails in queue:

# mailq 

2. To show the mail submission queue specified:

# mailq -Ac 

3. To show the “lost” items in the mail queue instead of the normal queue items:

# mailq -qL 

4. To show the quarantined items in the mail queue instead of the normal queue items:

# mailq -qQ 

5. To Limit processed jobs to those containing substr as a substring:

# mailq -q[!]I substr 

6. To Limit processed jobs to quarantined jobs containing substr as a substring:

# mailq -q[!]Q substr 

7. To Limit processed jobs to those containing substr as a substring of one of the recipients:

# mailq -q[!]R substr 

8. To limit processed jobs to those containing substr as a substring:

# mailq -q[!]S substr 

9. To Print verbose information:

# mailq -v 

Note

Sendmail is an intelligent mail agent, and it tries to deliver mail even when failures occur. For example, if a user attempts to send an email to user@hostname.com, and the mail server for hostname.com is turned off, sendmail will be unable to make a connection to TCP port 25 on the mail server for hostname.com and consequently won’t be able to deliver the mail. Instead of giving up, sendmail will place the email in a queue and attempt redelivery. The default action of sendmail is to attempt redelivery of queued mail every 4 hours for 5 days before giving up and sending a “Delivery Failure” notification to the original sender. Queued mail is stored in the directory /var/spool/mqueue and is managed by the program mailq.

Filed Under: Linux

Some more articles you might also be interested in …

  1. autoflake: A tool to remove unused imports and variables from Python code
  2. ping Command Examples in Linux
  3. hostnamectl: command not found
  4. gdalbuildvrt: Build Virtual Datasets from a list of existing datasets
  5. Apache Ant – Tool for building and managing Java-based projects.
  6. dvc checkout: Checkout data files and directories from cache
  7. gnmic Command Examples
  8. readpe Command Examples in Linux
  9. Most commonly performed operations in Yocto
  10. How to Disable/Enable services in Zimbra Mail Server

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright