Search code examples
centoscentos7postfix-mtamailx

Message keeps returning to mail queue on CentOS with Postfix


When I run "postsuper -d ALL" all messages from mailq are deleted. For a few seconds I am able to send emails from terminal just fine. However, even if I just stand still and do nothing after clearing the mailq, after about 20 seconds some new entries starts to show up in the queue, which prevents any other email message to be sent. In other words, if I clear the mail queue, and do nothing, new entries shows in the mail queue... and they prevent me to be able to send new email messages through the server.

I already tried:

  • Restarting the server
  • postfix stop
  • postqueue -f
  • postfix flush
  • postsuper -d ALL deferred
  • postsuper -d All
  • postsuper -r ALL
  • rm -rf /var/spool/postfix/defer/*
  • rm -rf /var/spool/postfix/deferred/*

I also tried to:

  • Uninstall postfix
  • Uninstall cyrus-sasl
  • Uninstall cyrus-imapd
  • Uninstall mailx

But when I re-install postfix, the issue comes back.

Nothing seems to prevent those new messages to show up on the mail queue again and again every 20 seconds.

How can I fix that?


Solution

  • I believe the issue was fixed by fixing permissions on the folder:

    /var/lib/imap/socket/lmtp
    

    There was also a small difference between the server's hostname and the hostname actually defined on the postfix config file. After those two things were fixed, the postfix was restarted. Hope this help someone in the future.