Postfix mail queue not being processed

Posted on 2009-02-14
Last Modified: 2013-12-06

I'm having big problems with my mail server. My Postfix mail queue doesn't seem to be getting processed anymore and messages seem to be placed in hold queue indefinitely.

If I run "postsuper -H ALL" the queue is released and when I restart Postfix the messages are delivered. However, the same thing starts all over again straight afterwards.

I've had to manually process the mailq for the past couple of hours and haven't been able to figure out the problem.

This problem may have started last night after I updated Debian, but I'm not sure - it could just be a coincidence. Here's the update:

Any help would be greatly appreciated as always!
Question by:Julian Matz
    LVL 76

    Expert Comment

    Could you look at the maillog /var/log/maillog and see whether postfix is recording any errors?
    LVL 21

    Author Comment

    by:Julian Matz
    No, I'm not seeing anything. The only thing that even resembles an error message are thes:

    postfix/smtpd[3768]: warning: hostname verification failed: Name or service not known

    ... but I think that's normal.

    The only other things I can see Postfix logging is

    - postfix/smtpd[4056]: NOQUEUE: reject: (Spamcop block, User unknown in virtual alias table, etc.)
    - postfix/cleanup[4038]: A31DF2F98: hold: header Received: from ....
    LVL 76

    Expert Comment

    Is this,,  the IP of your server?
    I do not believe the update you applied is the direct cause, but something else might be interfering with the operations of postfix.
    Check whether there are postfix updates.

    Stop and restart postfix and see what if anything is recorded in the maillog or in the /var/log/syslog or is it /var/log/messages which ever applies to your system.
    LVL 21

    Author Comment

    by:Julian Matz
    No, that's not my IP.

    One of the updates yesterday was a kernel update and I had to reboot the server after the update. It could also have had something to do with the reboot maybe.

    This is what I get when reloading Postfix:

    Feb 14 22:08:48 postfix/master[2485]: reload configuration /etc/postfix
    Feb 14 22:08:48 postfix/anvil[5305]: statistics: max connection rate 1/60s for (smtp: at Feb 14 22:06:16
    Feb 14 22:08:48 postfix/anvil[5305]: statistics: max connection count 1 for (smtp: at Feb 14 22:06:16
    Feb 14 22:08:48 postfix/anvil[5305]: statistics: max cache size 1 at Feb 14 22:06:16

    And this is a restart:

    Feb 14 22:09:00 postfix/master[2485]: terminating on signal 15
    Feb 14 22:09:00 postfix/master[5410]: daemon started -- version 2.3.8, configuration /etc/postfix
    LVL 21

    Author Comment

    by:Julian Matz
    There aren't any Postfix updates. My version is 2.3.8, which is the latest Debian stable version.
    LVL 76

    Assisted Solution

    The kernel update from the vendor should not affect the performance of an application also provided by the vendor.

    You may have email messages stuck that slow down the processing of other email.
    What is your queue retention period 7 days, 1 day, a few hours?
    Do you send your outgoing emails through your ISP as a smarthost?

    LVL 19

    Assisted Solution

    Just wondering f you installed MailScanner which does that.

    It creates an entry
    /^Received:/ HOLD
    in /etc/postfix/header_checks
    Which places all mail with a Received Header on the HOLD queue.

    You could check all your access lists like so

    grep hold /etc/postfix/*
    grep HOLD /etc/postfix/*
    grep Hold /etc/postfix/*
    LVL 25

    Assisted Solution

    can you post your sanitized; do you run mailscanner?  Just wondering if you have a scanner integrated into postfix where postfix is configured to move all emails immediately to hold queue and the scanner that is suppose to pick up the mail fails to process properly, leaving it in the hold queue.
    LVL 21

    Author Comment

    by:Julian Matz
    << You may have email messages stuck that slow down the processing of other email.

    I don't think so because I've been able to get the mail queue down to 0 a few times, but then every time a new message is sent or received, they are put on hold again and the queue just becomes bigger and bigger.

    << What is your queue retention period 7 days, 1 day, a few hours?
    What's the parameter or where is this defined?

    << Do you send your outgoing emails through your ISP as a smarthost?
    Not sure what this means exactly, but I think a smart host is like a front-end mail server or relay server. I don't use any 3rd party relay servers. Basically, when I send mail, I make a direct connection to my SMTP server (Postfix) on port 25. Postfix does relay mail for authorized users.

    Thanks for the link. I have gone through it but am still non the wiser :)

    I do have MailScanner installed. It's been installed for a couple of years now, but I also have Spamassassin working on the server, so at this stage I'd be more than willing to remove MailScanner if it will fix my problem.

    localhost:/etc/postfix# grep HOLD /etc/postfix/*
    /etc/postfix/header_checks:/^Received:/ HOLD

    localhost:/etc/postfix# postconf -n header_checks
    header_checks = regexp:/etc/postfix/header_checks

    Where do I go from here?

    << can you post your sanitized

    I have MailScanner and Spamassassin installed. How can I check whether MailScanner is picking up the held mail?

    LVL 21

    Author Comment

    by:Julian Matz
    Oh, I also have ClamAV integrated with MailScanner.
    LVL 21

    Author Comment

    by:Julian Matz
    Sorry - forgot to attach !!
    # see /usr/share/postfix/ for a commented, fuller
    # version of this file.
    # Do not change these directory settings - they are critical to Postfix
    # operation.
    command_directory = /usr/sbin
    daemon_directory = /usr/lib/postfix
    program_directory = /usr/lib/postfix
    home_mailbox = Maildir/
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    setgid_group = postdrop
    biff = no
    smtpd_helo_required = yes
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    myhostname = ***********
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    relayhost =
    mynetworks =
    mailbox_command = procmail -a "$EXTENSION"
    recipient_delimiter = +
    mydestination = $myhostname
    relay_domains = $mydestination
    smtpd_client_restrictions =
            check_client_access hash:/etc/postfix/access
    smtpd_sender_restrictions =
            hash:/etc/postfix/access, reject_unknown_sender_domain
    #smtpd_recipient_restrictions = hash:/etc/postfix/access, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_policy_service unix:private/policy, reject_rbl_client
    smtpd_recipient_restrictions = hash:/etc/postfix/access, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_rbl_client
    default_privs = mail
    mailbox_size_limit = 0
    message_size_limit = 51200000
    #mailbox_size_limit = 102400000
    smtpd_error_sleep_time = 0
    header_checks = regexp:/etc/postfix/header_checks
    virtual_maps = hash:/etc/postfix/confixx_virtualUsers, hash:/etc/postfix/confixx_localDomains
    smtpd_sasl_local_domain = $myhostname
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    virtual_alias_maps = hash:/etc/postfix/confixx_virtualUsers, hash:/etc/postfix/confixx_localDomains
    inet_protocols = ipv4
    #smtpd_sasl_path = /etc/postfix/sasl
    debug_peer_list =

    Open in new window

    LVL 25

    Accepted Solution

    just to verify if that is the problem or not, comment out the header_check in and reload postfix.  the email should stop going immediately to hold.

    btw, is mailscanner running? this would explain the lack of log entries as everything is operating fine; just that mailscanner isn't picking up the email and putting it into the incoming queue post-scan.
    LVL 21

    Author Comment

    by:Julian Matz
    I'm getting the feeling that MailScanner is not running. I checked /var/run/MailScanner/ and there is not PID file.

    localhost:/etc# /etc/init.d/mailscanner restart

    Stopping mail spam/virus scanner: MailScanner.
    Starting mail spam/virus scanner: MailScanner.

    localhost:/etc# ls -la /var/run/MailScanner/

    total 8
    drwxr-xr-x  2 postfix postfix 4096 Feb 14 00:22 .
    drwxr-xr-x 14 root    root    4096 Feb 14 21:14 ..

    Can't find MailScanner using ps -aux either...
    LVL 21

    Author Comment

    by:Julian Matz
    << btw, is mailscanner running?
    I don't think it is actually :)
    LVL 21

    Author Comment

    by:Julian Matz
    I changed the following line in the mailscanner init script to show me the stderr:
    --exec $DAEMON >/dev/null 2>&1

    This is waht I'm getting now:

    localhost:/etc# /etc/init.d/mailscanner start

    Starting mail spam/virus scanner: Variable "$FIELD_NAME" is not imported at /usr/share/MailScanner/MailScanner/ line 6064.
    Variable "$FIELD_NAME" is not imported at /usr/share/MailScanner/MailScanner/ line 6067.
    Global symbol "$FIELD_NAME" requires explicit package name at /usr/share/MailScanner/MailScanner/ line 6064.
    Global symbol "$FIELD_NAME" requires explicit package name at /usr/share/MailScanner/MailScanner/ line 6067.
    Compilation failed in require at /usr/sbin/MailScanner line 79.
    BEGIN failed--compilation aborted at /usr/sbin/MailScanner line 79.
    LVL 25

    Expert Comment

    Found this googling that error:

    I have experienced this problem and found that it is caused by upgrading
    libmailtools-perl from version 1.77-1 to 2.02-1.  The problem is fixed
    when downgrading the libmailtools-perl back to version 1.77-1.  This is
    reproducible as seen from the terminal capture below.

    Apparently there is some incompatibility between Mailscanner 4.58.9-2
    and libmailtools-perl version 2.02-1.

    LVL 21

    Author Comment

    by:Julian Matz
    I saw that but I only subscribe to Debian's stable package list and the current version in stable is 1.74.

    I do think my perl installations are messed up though. I noticed a few weeks ago that I cannot update my cpan modules. It keeps producing errors.

    Do you know how to get Postfix back working without MailScanner? I think I'm gonna remove it until I get the perl problem sorted.
    LVL 21

    Author Comment

    by:Julian Matz
    Ok, got it. Just had to remove header_checks from :)

    After flushing out the remaining messages that were being held, it now seems to working again.

    I still have to figure out the perl problem but at least the pressure is off now.

    Thanks for all your help. It was much appreciated!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Shouldn't all users have the same email signature?

    You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

    MS outlook is a premier email client that enable you to send and receive the e-mails with various file formats of attachments such as document files, media file, and many others formats. There is some scenario occurs when a receiver of an e-mail mes…
    Automapping, a wonderful feature with Exchange 2010 (SP2 onwards I believe), allows additional/Shared mailboxes that a user has access to be automatically mapped on Outlook client, simplifying the process by adding them while Outlook launches. Ho…
    In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
    The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now