Author Topic: Postfix Mail Server commands  (Read 42783 times)

0 Members and 2 Guests are viewing this topic.

Postfix Mail Server commands
« on: March 27, 2014, 10:12:09 PM »
Some useful postfix commands
postqueue -p = mailq    //postqueue -p is the same as mailq

service postfix reload    //reload config
service postfix restart   //restart postfix server

postconf  mail_version      //View the postfix version
postconf -d     //Show default postfix values
postconf -n     //Show non default postfix values

mailq     //list mail queue and MAIL_ID's, list mail queue
postqueue -p //list mail queue and MAIL_ID's, list mail queue
postfix  flush   // flush mail queue
postqueue -f    //process the queue now
postcat -q MAIL_ID     //read email from mail queue

postsuper -d MAIL_ID       //To remove MAIL_ID mail from the queue
postsuper -d ALL       //To remove all mail from the queue
postsuper -d ALL deferred        //To remove all mails in the deferred queue

postqueue -p | awk '/^[0-9,A-F]/ {print $7}' | sort | uniq -c | sort -n           //sort and count emails by "from address"

postqueue -p | grep '^[A-Z0-9]'|grep|cut -f1 -d' ' |tr -d \*|postsuper -d -          //removing all emails sent by:

postqueue -p | awk '/^[0-9,A-F].* / {print $1}' | cut -d '!' -f 1 | postsuper -d -      //remove all email sent from

To delete all messages from the queue by a certain user:
for i in `postqueue -p | grep | awk '{print $1}' | grep -v host | grep -v \*`; do postsuper -d $i; done

postqueue -p | grep '^[A-Z0-9]'|grep|cut -f1 -d' ' |tr -d \*|postsuper -d -      //remove all email sent by domain

postqueue -p | tail -n 1   //Mail queue stats short
postqueue -p | grep -c "^[A-Z0-9]"    //number of emails in Mail queue

tail -f /var/log/maillog    //watch logs live
« Last Edit: February 26, 2015, 04:51:41 PM by Administrator »
AntiDDoS Protection (web + mail)

Join our Development Team and get paid !

Services Monitoring & RBL Monitoring

Do you need Fast and FREE Support included for your CWP linux server?
Installation Instructions
Get Fast Support Here

Re: Postfix Mail Server commands
« Reply #1 on: April 13, 2019, 06:33:45 AM »
Where I can see the list email just to sent. I find in my WHM but I can not see. Help meee

Re: Postfix Mail Server commands
« Reply #2 on: September 10, 2020, 11:59:49 AM »
i'm having problem on Postfix.
When checking my smtp i'm getting error on rDNS is not a valid hostname.
   SMTP Valid Hostname   Reverse DNS is not a valid Hostname    More Info
   SMTP Reverse DNS Mismatch   OK - resolves to   
   SMTP Banner Check   OK - Reverse DNS matches SMTP Banner   
   SMTP TLS   OK - Supports TLS.   
   SMTP Connection Time   0.246 seconds - Good on Connection time   
   SMTP Open Relay   OK - Not an open relay.   
   SMTP Transaction Time   0.739 seconds - Good on Transaction Time

when checking postfix status i'm getting the following warning:

● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-09-10 10:34:28 SAST; 3h 7min ago
  Process: 8447 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
  Process: 8461 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 8459 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 8457 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 8528 (master)
   CGroup: /system.slice/postfix.service
           ├─ 8528 /usr/libexec/postfix/master -w
           ├─ 8530 qmgr -l -t fifo -u
           ├─ 8541 tlsmgr -l -t unix -u
           ├─10687 proxymap -t unix -u
           ├─10688 anvil -l -t unix -u
           ├─10696 trivial-rewrite -n rewrite -t unix -u
           └─28449 pickup -l -t fifo -u -o content_filter= -o receive_override_options=no_header_body_checks

Sep 10 13:39:44 postfix/qmgr[8530]: 425228C73: removed
Sep 10 13:39:47 postfix/smtpd[10743]: connect from unknown[]
Sep 10 13:39:47 postfix/smtpd[10743]: 48C518C70: client=unknown[]
Sep 10 13:39:47 postfix/cleanup[10704]: 48C518C70: message-id=<017b01d68767$02e32470$08a96d50$>
Sep 10 13:39:47 postfix/qmgr[8530]: 48C518C70: from=, size=61453, nrcpt=1 (queue active)
Sep 10 13:39:47 postfix/smtpd[10743]: disconnect from unknown[] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Sep 10 13:39:47 postfix/smtp[10914]: E9DF18C67: to=, relay=[]:10024, delay=7.4, delays=0.85/0.03/0.01/6.6, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[]:10025): 250 2.0.0 Ok: queued as 48C518C70)
Sep 10 13:39:47 postfix/qmgr[8530]: E9DF18C67: removed
Sep 10 13:39:47 postfix/pipe[10745]: 48C518C70: to=, relay=dovecot, delay=0.2, delays=0.08/0.01/0/0.11, dsn=2.0.0, status=sent (delivered via dovecot service)
Sep 10 13:39:47 postfix/qmgr[8530]: 48C518C70: removed

but my hostname is valid you can even browse it at

Can you assist me how to fix this why smtp are saying "Reverse DNS is not a valid Hostname".


Re: Postfix Mail Server commands
« Reply #3 on: September 10, 2020, 12:55:43 PM »
Why tag onto an existing thread that is nothing to do with your error?

Why do people find error messages so hard to comprehend? (rhetorical) Especially so, when the error is so clear in its' description.

   SMTP Valid Hostname   Reverse DNS is not a valid Hostname   
   SMTP Reverse DNS Mismatch   OK - resolves to   
That error is correct, as also shown here:

Summer will soon be over, along with the usual bunch of 'hosters'  ::)

« Last Edit: September 10, 2020, 12:59:48 PM by cynique »