Re: [Exim] converting qmail to exim3 system (and using ezmlm…

Pàgina inicial
Delete this message
Reply to this message
Autor: Nico Erfurth
Data:  
A: exim-users
Assumpte: Re: [Exim] converting qmail to exim3 system (and using ezmlm)
Hi,

if anyone is interested, i added support for ezmlm, it seems to work
fine, but i'm not sure about the way i use to pipe the messages into exim.

first, in my old config a little change is needed, the address_pipe
transport must be like this
----------------------------------------------------------------------------
#make a qmail-compatible pipe transport
#do some special-handling for ezmlm-commands
address_pipe:
driver = pipe
environment = LOCAL=$local_part$local_part_suffix : HOST=$domain
prefix = ${if match {$address_pipe}{ezmlm}{}{"From ${if \
def:return_path{$return_path}{MAILER-DAEMON}}${tod_bsdinbox}\n"}}
return_fail_output


further, ezmlm requires a special command from qmail, qmail-queue, to
place the message in the queue, i wrote a little wrapper and used exim
-bS to pipe the message to exim. the script must be in the place where
ezmlm excepts it (/var/qmail/bin by default)
----------------------------------------------------------------------------
the script qmail-queue
#!/usr/bin/perl -w

my $exim = '/usr/local/exim-test/exim';

open(MESSAGE,"<&0") || die "can't open 0 for reading";
open(ENVELOPE,"<&1") || die "can't open 0 for reading";


my @message = <MESSAGE>;
my $envelope = <ENVELOPE>;

my $sender;
my @receivers;

foreach (split("\0",$envelope)){
         last if $_ eq '';
         if (/T(.+)/) {
                 push @receivers,$1;
         } elsif(/F(.+)-\@\[]/) {
                 exit 54 if $sender;
                 $sender = $1;
         } else {exit 54;};
};
$| = 1;
exit 54 unless scalar(@receivers);
exit 54 unless length($sender);


unless(open (EXIM,"|$exim -bS")) {
         exit 54;
};


sub print_exim {
         my $text = shift;
         print EXIM $text || exit 54;
};


print_exim("EHLO xxx.de\n");
print_exim("MAIL FROM: $sender\n");
foreach (@receivers) {
         print_exim("RCPT TO: $_\n");
};
print_exim("DATA\n");
foreach (@message) {
         $_ =~ s/^\.$/\.\./;
         print_exim($_);
};
print_exim(".\nQUIT\n");


close (EXIM);

exit 0;