How can we help?


Enabling Greylists in Exim

Stewart -


I want to use greylisting on my server to help reduce spam.


  • On-Premise Server + WebMail Installations: Version 6.0 > Current Version


Greylisting is a method of defending e-mail users against spam. A mail transfer agent (MTA) using greylisting will "temporarily reject" any email from a sender it does not recognize. If the mail is legitimate the originating server will, after a delay, try again and, if sufficient time has elapsed, the email will be accepted.


  1. Open up /usr/local/atmail/mailserver/configure, and find this line:
    hide mysql_servers = localhost/atmail/root/
  2. Add the following below:
    .include /usr/local/atmail/mailserver/greylistconf
  3. Find this line:
    begin acl
  4. Add the following below:
    .include /usr/local/atmail/mailserver/greylistacl
  5. Find this line:
    MYSQL_CATCHALL = select AliasTo from MailAliases where AliasName='$domain'
  6. Add the following below:
    MYSQL_GREYLIST = SELECT DISTINCT value from SpamSettings where ( username='${quote_mysql:$local_part}@${quote_mysql:$domain}' or username='GLOBAL' ) and preference="greylist" and value='1' 
  7. Find this line:
    # deny message = Rejected message because $sender_host_address is in a black list at $dnslist_domain hosts = !+relay_from_hosts dnslists = #
  8. Add the following below:
    .ifdef GREYLIST_ENABLED defer condition = ${lookup mysql{MYSQL_GREYLIST}{$value}} acl = greylist_acl message = greylisted - try again later .endif
  9. Download the Gzipped file from:
  10. untar:
    % tar xvfz /tmp/greylist.tgz -C /usr/local/atmail/mailserver/
  11. Verify permissions:
    % chown -R atmail /usr/local/atmail/mailserver/greylist* 
  12. Import the databases:
    % mysql -u [dbuser] -p [dbname] < /usr/local/atmail/mailserver/greylist.sql 
  13. Rrestart atmail:
    % /etc/init.d/atmailserver restart
  14. Create a new DB greylist entry:
    mysql -u [dbuser] -p [dbname] -A mysql> insert into SpamSettings ( username, preference, value ) values ('[]', 'greylist', '1');
  15. Emails to [] will then be blocked on the first try. When the SMTP server of the sender retries, it will then be allowed. This is effective in stopping spam in the way that most spammers do not do retries for Spam emails.Caveat: The effectivity of this setup varies for each implementation. Some users may find that legitimate emails do not arrive to the proper mailboxes. Multi-SMTP server-setups may also be affected. We recommend that this be sandboxed, before implementation.


Contact our support team

+61 (7) 5357 6605