Difference between revisions of "Postfix Tips and Tricks"
(Created page with "== Inspecting Postfix’s email queue == === list of queued mail === Including deferred mail and pending for delivery. command: mailq The command 'postqueue -p' does the s...") |
(→Determine Installed Version) |
||
(4 intermediate revisions by one user not shown) | |||
Line 9: | Line 9: | ||
The command 'postqueue -p' does the same thing as 'mailq' | The command 'postqueue -p' does the same thing as 'mailq' | ||
− | === | + | === queue processing === |
+ | process entire queue now | ||
postqueue -f | postqueue -f | ||
− | |||
The command 'postqueue -f' does the same thing as 'postfix flush' | The command 'postqueue -f' does the same thing as 'postfix flush' | ||
+ | |||
+ | Schedule immediate delivery of all mail that is queued for the domain foo.com | ||
+ | postqueue -s foo.com | ||
=== delete / clear the queue now === | === delete / clear the queue now === | ||
postsuper -d ALL | postsuper -d ALL | ||
+ | |||
+ | postsuper -d messageid | ||
=== selective delete from queue === | === selective delete from queue === | ||
Line 30: | Line 35: | ||
Replace 'F276B2C0EA8' with the postfix id of your message. | Replace 'F276B2C0EA8' with the postfix id of your message. | ||
+ | |||
+ | qshape prints Postfix queue domain and age distribution information. | ||
+ | qshape active | ||
+ | shows the number of emails being sent to each domain and how long they have been in the active queue | ||
+ | |||
+ | qshape deferred | ||
+ | shows the number of emails in the deferred queue for each domain and how long they have been there | ||
+ | |||
+ | Your installation may not have qshape compiled by default. qshape does not seem to be included with the Redhat / Fedora / Trustix / CentOS postfix packages. It needs to be added. For those distributions 'yum install postfix-perl-scripts' | ||
+ | |||
+ | |||
+ | == Send Mail Test == | ||
+ | |||
+ | check if postfix can send emails | ||
+ | echo "Hello this is a test." | mail -s "Testing" admin@foo.com | ||
+ | |||
+ | follow the message by watching the log - the -f follow tells tail to actively display log activity. Be advised there is a timeout in which tail will fail to follow. | ||
+ | tail -f /var/log/mail.log | ||
+ | |||
+ | == Determine Installed Version == | ||
+ | |||
+ | If postfix is running and the main.cf specifies | ||
+ | smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) | ||
+ | you can | ||
+ | telnet localhost 25 | ||
+ | |||
+ | If postfix is not running you can check by the package. | ||
+ | |||
+ | There is no version switch on the postfix binary. Here are some ways you can determine what version of postfix is installed: | ||
+ | |||
+ | Redhat/Fedora/CentOS: | ||
+ | rpm -qa postfix | ||
+ | |||
+ | Debian/Ubuntu: | ||
+ | dpkg -s postfix | ||
+ | |||
+ | |||
+ | |||
+ | [[Category:Computer_Technology]] | ||
+ | [[Category:Linux]] |
Latest revision as of 19:51, 4 June 2015
Contents
Inspecting Postfix’s email queue
list of queued mail
Including deferred mail and pending for delivery.
command:
mailq
The command 'postqueue -p' does the same thing as 'mailq'
queue processing
process entire queue now
postqueue -f
The command 'postqueue -f' does the same thing as 'postfix flush'
Schedule immediate delivery of all mail that is queued for the domain foo.com
postqueue -s foo.com
delete / clear the queue now
postsuper -d ALL
postsuper -d messageid
selective delete from queue
postsuper -d ALL deferred
inspecting queue
You can view the specific message in queue if you have the id
postcat -vq F276B2C0EA8 > themessage.txt
Replace 'F276B2C0EA8' with the postfix id of your message.
qshape prints Postfix queue domain and age distribution information.
qshape active
shows the number of emails being sent to each domain and how long they have been in the active queue
qshape deferred
shows the number of emails in the deferred queue for each domain and how long they have been there
Your installation may not have qshape compiled by default. qshape does not seem to be included with the Redhat / Fedora / Trustix / CentOS postfix packages. It needs to be added. For those distributions 'yum install postfix-perl-scripts'
Send Mail Test
check if postfix can send emails
echo "Hello this is a test." | mail -s "Testing" admin@foo.com
follow the message by watching the log - the -f follow tells tail to actively display log activity. Be advised there is a timeout in which tail will fail to follow.
tail -f /var/log/mail.log
Determine Installed Version
If postfix is running and the main.cf specifies
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
you can
telnet localhost 25
If postfix is not running you can check by the package.
There is no version switch on the postfix binary. Here are some ways you can determine what version of postfix is installed:
Redhat/Fedora/CentOS:
rpm -qa postfix
Debian/Ubuntu:
dpkg -s postfix