Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I set up a mail server with Dovecot, Postfix and AMaViS on Debian Squeeze following the tutorial on (ISPmail tutorial for Debian Squeeze). It uses virtual domains and stores the domains, e-mail addresses and accounts in a MySQL database.

Everything works fine – except I am missing some e-mail headers.

Received headers:

  • X-Quarantine-ID
  • X-Virus-Scanned

(With “real” spam and using the GTUBE via sendmail < /usr/share/doc/spamassassin/examples/sample-spam.txt)

Missing headers:

  • X-Spam-Flag
  • X-Spam-Score
  • X-Spam-Level
  • X-Spam-Status

But spam e-mails get their subject changed. So I set up everything correct, didn’t I?

How do I get those missing headers in my mails?

Here my AMaViS configuration file (/etc/amavis/conf.d/50-user)

use strict;

# Place your configuration directives here.  They will override those in
# earlier files.
# See /usr/share/doc/amavisd-new/ for documentation and examples of
# the directives you can use in this file

# see <>

$sa_spam_subject_tag = '*** SPAM *** ';
$final_spam_destiny = D_PASS;

$sa_tag_level_deflt = -9999; # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 6.31; # add 'spam detected' headers at that level

@lookup_sql_dsn = ([

$sql_select_policy = 'SELECT name FROM virtual_domains WHERE CONCAT("@",name) IN (%k)';

#------------ Do not modify anything below this line -------------
1;  # ensure a defined return

If you need more configuration files, log outputs or anything else, please leave a comment below and I will update my post with the information you need :-)

share|improve this question

Have you checked this parameter: @local_domains_acl

It is defined on /etc/amavis/conf.d/05-domain_id. According to the Amavisd-new documentaion on

No spam-related headers inserted? Here are some reasons:

  • @local_domains_acl is not correctly set. These headers are only inserted for recipients matching @local_domains_acl lookup (or %local_domains or $local_domains_re or field 'local' in SQL lookups);
  • (...)

Check the output of this command: head -n 1 /etc/mailname

If you will not get exactly your domain name than Amavisd will not apply any change to the headers of your emails. If you want to force the adding of the X-Spam-* headers than you can add something like this @local_domains_acl = ( "." ); on /etc/amavis/conf.d/50-user

share|improve this answer

(This is really a comment to the previous answer, but the reputation system won't let me)

Setting @local_domains_acl = ( "." ) worked for me, but it seemed like a rather blunt instrument (i.e., spam processing all messages, in or out). Trying a number of alternatives, I eventually found that including localhost would also help (I'm testing with a delivery service on the same box). Thus, in /etc/amavis/conf.d/50-user I have something like:

@local_domains_acl = ( "", "localhost" );

and I'm seeing messages delivered with spam headers added.

(My test setup here is Ubuntu 14.04 server, postfix, amaviz, spamassassin, all installed from standard Ubuntu repositories.)

share|improve this answer

The output of command head -n 1 /etc/mailname must be your domain, like

If the output is something like, that's the bug.

So, you can fix this by changing the file /etc/amavis/conf.d/05-domain_id

Solution #1

Inside /etc/amavis/conf.d/05-domain_id:


    chomp($mydomain = `head -n 1 /etc/mailname`);


    chomp($mydomain = `hostname -d`);

PS: The output of hostname -d must be your domain, like

Simplest solution than ever:

Inside /etc/amavis/conf.d/05-domain_id:


    chomp($mydomain = `head -n 1 /etc/mailname`);


    $mydomain = "";
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.