[Exim] Hackish LMTP delivery

Top Page
Delete this message
Reply to this message
Author: Kyle Smith
Date:  
To: exim-users
Subject: [Exim] Hackish LMTP delivery
I'm using exim 3.15 and cyrus 1.6.24 on FreeBSD, and I've come up with a
way to get exim to (somewhat indirectly) deliver LMTP to cyrus's deliver
program. I'm mainly looking for comments and suggestions here. It seems
to work ok, I just want to make sure I'm not missing anything important.

Here's the exim transport I'm using:

local_bsmtp:
driver = pipe
command = "/usr/local/cyrus/bin/lmtp.pl"
delivery_date_add
envelope_to_add
return_path_add
user = cyrus
group = cyrus
bsmtp = domain
return_output
log_output
prefix =
suffix =

########

And here's /usr/local/cyrus/bin/lmtp.pl:

#!/usr/bin/perl -wT

use strict;

use FileHandle;
use IPC::Open2;

$ENV{PATH} = "/usr/local/cyrus/bin";
$ENV{ENV} = "";

$| = 1;

my $deliver = "/usr/local/cyrus/bin/deliver -e -l";
my $hostname = "postel.capitol-college.edu";

my $pid = open2(\*LMTPIN, \*LMTPOUT, $deliver);

print LMTPOUT "LHLO $hostname\n";

my $prevline = "";

while (<>) {
    next if ($prevline =~ /^DATA$/);


    print LMTPOUT $_;
} continue {
    $prevline = $_;
}


print LMTPOUT "QUIT\n";

my @output = *LMTPIN->getlines();

foreach my $line (@output) {
    #452 4.2.2 Over quota
    if ($line =~ /^[^23]\d\d (.*)$/) {
        print "Error: ", $1, "\n";
    }
}


########

-kyle