Exim4 integration?

Use this forum to get help.

Exim4 integration?

Postby Mandarb » Thu Nov 11, 2004 8:33 pm

Is anyone using exim4 with spamgourmet? I am trying to set up a personal site and have most of it working (more questions in another post), but I'm not sure how to integrate it with exim4.

Do I forward all emails through spamgourmet? What happens to local deliveries (i.e. myuser@mydomain.com)?

Thanks,
Omen
Mandarb
 
Posts: 4
Joined: Thu Nov 11, 2004 8:16 am

Postby josh » Thu Nov 11, 2004 9:07 pm

It should work with exim, but we've never tested it. The trick is to forward all email for a particular domain to the spamgourmet code. If you only have the one domain, you can either use the "unix accounts" spamgourmet configuration (not tested for a long time), or explicitly deliver mail to local accounts prior to sending all mail to the spamgourmet code.
josh
 
Posts: 1371
Joined: Fri Aug 29, 2003 2:28 pm

Postby Mandarb » Tue Nov 23, 2004 2:24 am

Okay, here is what I have done so far to get spamgourmet to work with exim4 (Debian unstable). I am using the split config files option so I had to add two new exim4 config files and a small patch to spameater.pl. The patch is required because exim4 does not put angle brackets around the for in the received headers.

Code: Select all
--- spameater.pl        19 May 2004 01:50:14 -0000      1.2
+++ spameater.pl        23 Nov 2004 02:13:15 -0000
@@ -116,8 +116,8 @@
     }
 
     if (!$for || $for eq $config->getOtherDomainEmail()) {
-      $line =~ /^.*for <(.+)>/;
-      $for = $1;
+      $line =~ /^.*for (<(.+)>|([^;]+))/;
+      $for = $2 || $3;
       if (!$for || $for eq $config->getOtherDomainEmail()) {
         $line =~ /^Delivered\-To\:\s+\w+\-\w{3}\-(.*)/;
         $for = $1;


/etc/exim4/conf.d/router/950_exim4-config_spamgourmet
Code: Select all
### router/9t0_exim4-config_spamgoumet
#################################

spamgourmet_backup:
  debug_print = "R: spamgourmet backup for $local_part@$domain"
  driver = accept
  domains = +local_domains
  local_part_prefix = *. : *~ : +*+*+
  transport = spamgourmet_pipe_backup
  unseen

spamgourmet:
  debug_print = "R: spamgourmet for $local_part@$domain"
  driver = accept
  domains = +local_domains
  local_part_prefix = *. : *~ : +*+*+
  transport = spamgourmet_pipe


/etc/exim4/conf.d/transport/30_exim4-config_spamgourmet_pipe
Code: Select all
spamgourmet_pipe:
  debug_print = "T: spamgourmet_pipe for $local_part@$domain"
  driver = pipe
  path = "/bin:/usr/bin:/usr/local/bin:/home/spamgourmet/spamgourmet/mailhandler"
  command = "/home/spamgourmet/spamgourmet/mailhandler/spameater.pl"
  user = spamgourmet
#  group =
  environment = "SG_DIR=/home/spamgourmet/spamgourmet:SG_CONF_FILE=/home/spamgourmet/spamgourmet/conf/spamgourmet.config"
  #return_path_add
  #delivery_date_add
  #envelope_to_add

spamgourmet_pipe_backup:
  debug_print = "T: spamgourmet_pipe_backup for $local_part@$domain"
  driver = appendfile
  file = /var/mail/spamgourmet
#  delivery_date_add
#  envelope_to_add
#  return_path_add
  user = MYUSER
  group = mail
  mode = 0660
  mode_fail_narrower = false


Then run
Code: Select all
sudo update-exim4.conf; sudo /etc/init.d/exim4 restart
and you should be all set.

The reason I use two transports and two pipes is to make a backup copy of every email in /var/mail/spamgourmet before it gets delivered to spameater.pl. This is just for debug purposes.

I do not have a special domain for spamgourmet, so I had to find a way for exim4 to realize which emails should be routed to spameater.pl. I did this with
Code: Select all
  local_part_prefix = *. : *~ : +*+*+
It is a little crude (any email address with a . or a ~ in it, or any address that has 3 pluses) but it seems to work.

Omen
Mandarb
 
Posts: 4
Joined: Thu Nov 11, 2004 8:16 am


Return to Support / Hilfe / ayuda / ondersteuning / ...

Who is online

Users browsing this forum: No registered users and 95 guests

cron