Simple Mail Queue Question

Discussion in 'Installation/Configuration' started by rlischer, Feb 8, 2013.

  1. rlischer

    rlischer Member

    What exactly is the mail queue? I see email pop up in there every now and then, some stay for hours some don't. Does this mean some are stuck? Is there a was to clear it or force a stuck email to send?

    running Debian Squeeze perfect server nginx.

  2. Parsec

    Parsec New Member

    Ok, the answer could get complex quite easily but I'll try to keep it simple rather then technical.

    The mail queue is the process the mail server uses to store an email for delivery. Every email will go into the queue. Think of it as a temporary place the mail server puts it while it decides what to do with it.

    When ready, the mail server will pull the email from the queue and do what is decided has to be done with it. If there is a problem with the action, the mailserver will return the email to the queue and try the action again later.

    So, say you are sending an email to some one, your email is received by your mailserver and goes into the queue. then the mail server grabs it again and attempts to deliver it, if all goes well, it's done and gone. If the other end is offline, has a problem etc, the mail server fails to deliver the email and thus returns it to the queue - it will try and deliver it again later.

    There can be a zillion reasons why an email isn't delivered straight away - thus the queue is important. If the email cannot be delivered then that's when you receive a bounce. There are hard and soft bounces - but I won't get into that here.

    Assuming you are using postfix on your debian system the mail queue can be viewed from the command line with "postqueue -p", you can force postfix to try and send all mail in the queue by "postqueue -f". If you do this you should also watch your log "tail -f /var/log/mail.log" to see reasons why the mail isn't delivered. You can also most probably find web cgi based programs to view the queue - if you want.

    For postfix, the config lines in which control how long postfix will leave the mail in the queue before giving up are "bounce_queue_lifetime" and maybe "maximal_queue_lifetime". With ISPConfig these are left at default values - you can see these by "postconf -d | grep queue" on the command line.

    So in answer to your question, the mail queue is a good thing and if you are woried about why some appear to stay there a while then maybe you need to find something that displays you the current queue. I use a little web cgi (perl) script that outputs it to a webpage called "" but I don't remember where I got it.

    Hmm, did I actually answer your question?
  3. rlischer

    rlischer Member

    Wow! Thank you very much, this makes sense to me now. I appreciate the way you explained it! My queue is empty now so now I feel confident that things are working well.


Share This Page