[Mimedefang] $QueueId not allways defined

Bill Cole mdlist-20140424 at billmail.scconsult.com
Fri Sep 23 22:49:39 EDT 2016

On 23 Sep 2016, at 17:58, Thomas Kristensen wrote:

> Hallo
> I just installed postfix and mimedefang, and i works pretty nice.
> But in some cases that $QueueId is not defined, only as NOQUEUE.
> I cant see why this is only happing to some of the mails and not all.
> I tend to be some a certin host, but on sometimes the variable is 
> fine, even from the host.
> How can i debug this even futher to see why the variables is not 
> allways defined?

This can be dependent on software versions, since there can be a 
combination of a Postfix quirk and a  MIMEDefang adaptation to that 
quirk which was overdone prior to a fix published in April 2015 which is 
not in the latest release version.

The Postfix quirk is that for performance reasons relevant only to 
rather high-volume systems, by default it delays the assignment of a 
QueueID and creation of a file in its incoming queue directory until it 
has accepted one recipient for a message. This behavior can be changed 
with this Postfix setting:

smtpd_delay_open_until_valid_rcpt = no

That causes Postfix smtpd to create a QueueID as soon as it takes 
control of the SMTP session (either answering it directly or being 
passed the connection from postscreen) so in principle it should be 
available at all stages in the milter protocol. However, until very 
recent versions of MIMEDefang, it assumed the default behavior of 
delaying the creation of the queue file and hence the QueueID, and 
didn't ask for the QueueID at any milter stage before filter_begin. So 
if you're not running MD 2.78 plus the patch available at 
you will get NOQUEUE as the QueueID at all stages before filter_begin, 
even if Postfix is logging about the message with a QueueID before MD 
logs without one.

And tangentially related...

I also advise this Postfix setting:

enable_long_queue_ids = yes

That makes Postfix use 17-character IDs that encode a timestamp (and 
other information), are created in lexicographic order, and will never 
repeat on one host unless the clock gets set backwards.

More information about the MIMEDefang mailing list