Postfix common command line: send email to execute startup restart debugging maintenance service

Here is the CWP control panel: postfix mail server statistics and graphsYouTubeVideo Tutorial ▼

Install CWP Control Panel, you can easily view the statistical status of the mail server in the form of a pie chart ▼

Postfix common command line: send email to execute startup restart debugging maintenance service

postfix common command line

Here is a summary of some common postfix command lines.

List mail queues and MAIL_ID's command ▼

postqueue -p

mailq

postqueue -p |tail

  • postqueue -pmailqThe command is the same.

postfix start command

Start postfix server ▼

 postfix:postfix start   

stop postfix server ▼

 postfix:postfix

Reload postfix configuration ▼

service postfix reload

Restart postfix service command

Restart postfix server ▼

service postfix restart

View postfix version ▼

postconf mail_version

Show default postfix value ▼

postconf -d

Show non-default postfix values ​​▼

postconf -n

Refresh mail queue ▼

postfix flush

postfix debug command

Process the queue immediately ▼

postqueue -f

Process any emails that are stuck in the queue ▼

postsuper -r ALL && postqueue -f

Read email from mail queue ▼

postcat -q MAIL_ID

Remove MAIL_ID message from queue ▼

postsuper -d MAIL_ID

Remove all messages from the queue ▼

postsuper -d ALL

Quickly remove all from the mail queue ▼

find /var/spool/postfix/deferred/ -type f | xargs -n1 basename | xargs -n1 postsuper -d

Delete all messages in the delayed queue ▼

postsuper -d ALL deferred

postfix maintenance commands

Sort and count emails by "From Address" ▼

postqueue -p | awk '/^[0-9,A-F]/ {print $7}' | sort | uniq -c | sort -n

Delete all emails sent: mailto:[email protected]

postqueue -p|grep '^[A-Z0-9]'|grep user@ adminlogs. info|cut -f1 -d' '|tr -d \*|postsuper -d -

Delete all emails sent from [email protected]

postqueue -p|awk '/^[0-9,A-F].*user@ admin.info / {print $1}'|cut -d '!' -f 1|postsuper -d -

Delete all emails from the domain adminlogs.info▼

postqueue -p | grep '^[A-Z0-9]'|grep @adminlogs. info|cut -f1 -d' ' |tr -d \*|postsuper -d -

Message queue statistics are short ▼

postqueue -p | tail -n 1

Number of emails in the mail queue ▼

postqueue -p | grep -c "^[A-Z0-9]"

Email Quick Count in Mail Queue ▼

find /var/spool/postfix/deferred -type f | wc -l

View mail log▼

tail -f /var/log/maillog

Count and sort successful pop3/imap logins ▼

grep "\-login" /var/log/dovecot-info.log |grep "登录:"|awk {'print $7'}|sort|uniq -c|sort -n

Count and sort successful SMTP postfix logins (for tracking down spammers)▼

grep -i "sasl_username" /var/log/maillog |awk {'print $9'}|sort|uniq -c|sort -n

Count and sort successful SMTP postfix logins on the exact date "June 6" ▼

grep -i "sasl_username" /var/log/maillog |grep "Jun 18"|awk {'print $9'}|sort|uniq -c|sort -n

Analyze postfix logs ▼

pflogsumm /var/log/maillog | less
  • If you don't have pflogsumm, then you can install this rpm package"postfix-perl-scripts"

There is also postfix avoid spam setup tutorial ▼

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "Postfix Common Command Line: Send Email to Execute Start, Restart, Debug and Maintain Service", which is helpful to you.

Welcome to share the link of this article:https://www.chenweiliang.com/cwl-27769.html

Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!

🔔 Be the first to get the valuable "ChatGPT Content Marketing AI Tool Usage Guide" in the channel top directory! 🌟
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!

 

Comment

Your email address will not be published. Required fields * Callout

scroll to top