John Peacock wrote:
Chris Winters wrote:
Matt's brief talk + a few nudges from other YAPC::NA folk got me
looking at qpsmtpd again. I'm interested in hooking it up to cyrus
and to that end I saw a May 25 message regarding LMTP. Is there a
working plugin available for this? I grabbed the trunk from svn and
didn't see one in plugins/.
Hanno Hecker posted a proof of concept LMTP plugin back in March
(connect to nntp.perl.org server and subscribe to perl.qpsmtpd). LMTP
is really just SMTP with some important validation bits left out.
But there are some differences in how LMTP handles failures that may
be hard to translate into SMTP (Hanno meantions issues with
unvalidated users in his e-mail). The problem is that LMTP can return
individual return codes for each address (think temporary failures due
to quotas) and assumes that all recipients are already validated.
SMTP only understands a single return for all recipients.
Consequently, if queuing a message for one user using LMTP fails, you
wind up signalling to the remote SMTP session that the entire
transaction had a 4xx error, which will cause a resend (and duplicate
messages).
This may not be an issue, since the whole point of qpsmtpd is to not
accept mail in the first place that we are not able to ultimately
deliver. It may be possible to limit the recipients to 1 per
transaction, but there are likely to be many MTA's where this would
fall afoul of their retry intervals...
John
queue can have a lookup of some kind to split the
recipient list, deciding whether to queue lmtp
recipients to postoffice and issue an OK to block
qmail-queue, or DECLINE one or more relay
recipients to qmail-queue.
This requires mangling the recipient list to subtract
lmtp recipients before declining to qmail-queue if
any relay recipients are left. If none, return OK.
I find it easier to hand an array to a qmail-queue
lookalike sub than to mangle the recipient list
and DECLINE to qmail-queue. Or both.
The lookup can be flatfile, db file, sql, ldap. I'm
using ldap. I'll try to generify my plugins but today
I had enough trouble, but I'll be trying to find time
to generify my working queue as far as the skeleton
code for splitting the two streams of local and relay
recipients, without regard to which method of lookup
or which queue method is then plugged in.
Actually I'm going in the opposite direction with
my site-specific queue. I'm about to add a bloat
feature to allow pop users with dspam by adding
a THIRD queue method, queuing the spam- and
notspam- dspam alias messages to maildir
files which some old cron can sweep up and
dspamc them away, at a leisurely pace because
there won't be many. May add a FOURTH queue
method for list managers! It's almost a 10k
plugin now.
-Bob
foreach $to ( &to_list ( $self , $transaction ) , @bcc_sent ) {
if ( $to ) {
$to_user = lc substr ( $to , 0 , index ( $to , '@' ) ) ;
$msg_id = &_msg_id ( $self , $transaction , $from_host , $MSG_N++ ) ;
$to_host = lc substr ( $to , ( index ( $to , '@' ) + 1 ) ) ;
$transaction->header->delete( 'Delivered-To' ) ;
$transaction->header->add( 'Delivered-To' , $to , 0 ) ;
my $lmtp = Net::LMTP->new( '192.168.1.3' , 24 ,
Timeout=>60 ,
Hello => 'here:hackme' );
if ( $lmtp and $transaction->body_size ) {
if ( index ( $from , '@' ) + 1 ) {
$lmtp->mail ( $from_user . '@' . $from_host ) ;
}
else {
$lmtp->mail ( $from ) ;
}
$lmtp->to( $to_user . '@' . $to_host ) ;
$lmtp->data ;
$lmtp->datasend( $transaction->header->as_string ) ;
$transaction->body_resetpos ;
$lmtp->datasend( $line )
while $line = $transaction->body_getline ;
$lmtp->dataend ;
$lmtp->quit ;
undef $lmtp ;
.....................
sub qmail_relay {
my ( $self , $transaction ) = @_ ;
my $config = $self->{_queue_lmtp_config} ;
if ( $#Q + 1 ) {
pipe(MESSAGE_READER, MESSAGE_WRITER) ;
pipe(ENVELOPE_READER, ENVELOPE_WRITER) ;