Donate

Categories

Advert

XHTML

Valid XHTML 1.0 Transitional

I need an LMTP server

I am working on a system where a front-end mail server sends mail to what it considers to be a LDA (Local Delivery Agent) which actually sends mail to a back-end server via LMTP. I can’t remove that fake LDA from the design because it does a bunch of business specific processing along the way.

I am working on changing the back-end from Cyrus to Dovecot. Currently the mail goes from the fake LDA to the Cyrus LMTP server. What I would like to do is to have an LMTP server run on the back-end machine that launches the Dovecot deliver program immediately and then returns an appropriate code.

So far I have been experimenting with having Postfix run on the back-end to use deliver as the real LDA. The first problem with this is that the mail will be written to the Postfix queue and then written to the mail store. Doubling the number of writes is a real problem for a system that is going to be write-bottlenecked – it would significantly increase the hardware costs. The second problem is that when an account goes over quota the back-end server would be generating a bounce message. I would prefer the front-end server to generate the bounce on an un-munged message.

Basically all I need is a simple daemon (which could even be launched from inetd) that talks LMTP (a very simple cut-down version of SMTP) and executes a single command to receive the data. It might be necessary to serialise running the delivery process, in which case the mail data would have to be stored in memory and there would need to be a semaphore around executing the delivery program.

Does anyone know of such a program? If not then I’ll have to write it myself (which shouldn’t be difficult) and GPL it. If I have to do that then I need a suitable name for it. Any suggestions would be appreciated.

10 comments to I need an LMTP server

  • hah

    Try qpsmtpd. Should be easy to modify as LMTP server, with an extra queue plugin which delivers to dovecot.

  • s j west

    Can’t help you, but in Lenny you need to add 24 lmtp/tcp stuff to the /etc/services file otherwise things might not work.

    Cyrus imap in Debian is not that bad once you have been told your an idiot in the readme files and you fix a directory, and rename that file.

  • Dunno about postfix; but exim can speak LMTP natively, and can write to a number of formats that dovecot understands all by itself (Maildir, for example). Perhaps you may want to try going that route.

  • mitu

    Postfix already knows to deliver via LMTP, no need to use ‘deliver’ – in fact this has been the recommended way for postfix+cyrus setups for years. See http://www.postfix.org/OVERVIEW.html. You can shoot two birds with one stone – you’ll get quota rejection messages before the mail is accepted by smtp if the message cannot be delivered.

  • etbe

    hah: qpsmtpd is an interesting project, and I could easily switch to using SMTP (I’ve already written the code). But I couldn’t find any information about it’s delivery process, I guess I would have to read the code to discover whether it queues or not. I want to use Dovecot deliver as it can apparently update indexes during the delivery process.

    s j west: I think that Cyrus is that bad, I’ve been running it on a large system for a while and have not been happy.

    Wouter: Exim is a very capable mail server, but I would like to take advantages of some of Dovecot’s delivery options and not have a queue.

    mitu: Postfix knows how to send via LMTP (LMTP client) but doesn’t know how to be an LMTP server. Anyway my current situation is using Postfix on a test machine and I want to stop writing each message twice.

    Thanks for all the suggestions!

  • mitu

    ok, I misunderstood the question, how about using amavisd-new on the backend ? It speaks LMTP and you can both receive and deliver via LTMP, integrates nicely with postfix (content filter before and after SMTP).

  • hah

    I have to admit, the settings are sometimes a bit hard to find in qpsmtpd :)
    $ cat config.sample/size_threshold
    # Messages below the size below will be stored in memory and not spooled.
    # Without this file, the default is 0 bytes, i.e. all messages will be spooled.
    10000

  • etbe

    mitu: Amavis is an anti-virus framework. I can’t imagine how that would help. My problem is efficiently getting mail into the store, not merely finding an LMTP server (I’ve already got the sending code working with both SMTP and LMTP).

    hah: Thanks for that, I’ll have another look at qpsmtpd.

  • etbe

    hah: Is this size_threashold file supposed to just be dropped under /etc/qpsmtpd?

    Also how do I get qpsmtpd to directly call deliver without having to hack the code? It might be easier for me to write my own LMTP server in C than to work on someone else’s Perl code.

  • NicoD

    I’m looking for a lightweight LMTP-server as wel, but when I have the time I’ll check the following setup:

    maidag (from the GNU mailutils package) can be used receive messages via LMTP, and is able to deliver to a mailbox using an external command (such as Dovecot’s deliver).

    Having a Postfix server on my backend mailstores is not something I’m looking forward to.

    http://www.gnu.org/software/mailutils/
    http://www.gnu.org/software/mailutils/manual/html_node/Remote-Mailbox-Delivery.html