# Minimal MTA (local delivery only) [Solved]

## deadram

I want a very simple, very minimal MTA for local delivery of emerge reports, cron jobs, and other such stuff. I've got postfix working as a local MTA, but it's doing both local delivery and external delivery (for the local box). The other day I saw a mail in the queue to up the user count of pine (I had just installed it). I don't mind having something listening on 127.0.0.1:25, but I'd prefer if any mail that can't be delivered locally be silently dropped into root's mailbox (like that pine user count email I was never asked if I wanted to send >.<).

I was actually thinking of installing mailx and using that to send mail from cron jobs (and unmerging postfix). I was just wondering if that might cause problems with other programs? I would guess most come preped to use sendmail; but probably have a way to configure them to work with mailx. I'm guessing pine tried sendmail or 127.0.0.1:25, and other programs I use might get a little funky without either or both.

If postfix could just deliver all mail to a single local mailbox I'd probably be alot happier. Happier still if the MTA I used couldn't scale, and wasn't able to do things like maintain a queue (postfix, exim, and the likes seem like overkill to me; I don't expect more then 1 mail every 5 minutes for an hour, all created, sent, and delivered locally).

----------

## deadram

bump

--

Seems after a litle more investigation the mailx utils want an smtp server to do thier thing.

I've also been unable to find anything in sourceforge or ~deeper~ googling.

Is there a way to configure postfix (or exim, qmail, etc...) to drop all mail recieved from anywhere destined to any user@domain combo into a single local mailbox?

From there I'm sure I can find tools to filter a maildir/mbox into folders, run a pop/imap server, etc... Just seems odd to me that nobody ever wanted something like this before 0.o Maybe I should start hacking away the clutter on a postfix fork ^.~

----------

## neonknight

Have you already checked out esmtp?

----------

## cach0rr0

 *deadram wrote:*   

> bump
> 
> Is there a way to configure postfix (or exim, qmail, etc...) to drop all mail recieved from anywhere destined to any user@domain combo into a single local mailbox?
> 
> 

 

I do precisely this with postfix, as my system is purely a honeypot (and well, I'm the only user)

check out luser_relay setting

there's also the alias mapping if you only want certain users rerouted (/etc/mail/aliases - requires postmap)

If you're curious, all of my .conf are here - https://whitehathouston.com/topics/index.php/WHHMail

everything for my domain gets routed to one alias. I do some filtering beforehand - again, purely to gauge effectiveness of certain solutions - but otherwise, anything that makes it through the filtering gets sent to my meat alias (dont ask) within ~/.maildir, read via dovecot+Horde

hope that helps

----------

## qubix

you might consider mail-mta/ssmtp - i use it whenever i ONLY need to offload cron logs and stuff.

----------

## deadram

I've tried to find a config for ssmtp, but it seems to only relay mail off to a hub (which I ~could~ have, but again... overkill  :Razz: ).

I'mah give esmtp (with procmail) a shot; seems esmtp can send to a relay or to a local MDA binary (which from what I understand is what procmail provides).

If that fails, I'll try to play with postfix and luser.

Thanks for all the help guys (and gurls? ^.~). If things don't work out I'll drop another line; but I think we've found a couple solutions that will work nicely  :Smile: 

----------

## qubix

On the other hand if your not that tight on ram (guess 20M is enough), than postfix could be the way to go. It requires totally zarro configuration to be a local delivery mta, as far as i remember.

----------

## deadram

Found what I was looking for... or at least something close enough  :Smile:  3 actual config lines to boot.

```

some@box $ /usr/bin/emerge -a procmail

...

some@box $ /usr/bin/emerge -a esmtp

...

some@box $ sudo echo 'mda="/usr/bin/procmail"' > /etc/esmtprc

some@box $ sudo echo ':0' > /etc/procmailrc

some@box $ sudo echo '/home/some/.maildir/' >> /etc/procmailrc

```

Now anything that uses "sendmail <name>" will drop mail into my maildir as long as name doesn't include an @ sign.

There's a bit of tweaking... I'm guessing I'll run into some permission problems down the road (procmail doesn't know to be root or user "some" when it does the delivery; afaik). All in all it does what I want, without any unneccessary bloat to my HD, RAM or CPU  :Smile: 

Thanks for all the tips and help.

----------

## Hypnos

deadram,

Thanks for figuring this out.  Some things:

* Do you know if there exist relay-only MTAs other than esmtp that allow you to specify an MDA?

* Oh, the ebuild now sets up the default maildrop for you in /etc/procmailrc.  I prefer mbox in /var/spool/mail -- don't want some program writing to my home directory.   I had to specify

```
mda="procmail -f %F"
```

otherwise my mail reader (Evolution) couldn't parse the spool file.

* It is probably more "Unix"-y if you specify who should receive root's email in /etc/mail/aliases.

----------

## Hypnos

Ach, esmtp decides that anything with "@" in it needs to go to an SMTP relay, even if it's "@localhost".  According to RFC2822, all addresses require "@", so "localhost" needs to be in there for local addresses.

I'm going to have to write my own local-only MTA ...

In the meantime, I just wrote a simple /usr/sbin/sendmail script:

```
#!/bin/sh

procmail -f cron -d me
```

and soft-linked /usr/lib/sendmail.

----------

