# qmail/sendmail/postfix/anything

## irwinr

Been trying to get an email server going, but I can't get any to work.  I've installed/uninstalled/reinstalled all 3 of the following mail servers, did all of the required configuration, etc:

sendmail

postfix

qmail

No errors in the logs, everything seems to work perfectly, but mail never ends up in the users mailbox.  I'm using both 'mail' and 'pine' as mail clients.  I've tried following every gentoo howto I can find, and still nothing.

From /var/log/qmail/qmail-send/current:

```
@4000000042d9e45c0bff192c starting delivery 10: msg 6454826 to local jeremy@server

@4000000042d9e45c0bff24e4 status: local 2/10 remote 0/20

@4000000042d9e45c0bff28cc delivery 9: success: did_0+1+0/qp_26640/

@4000000042d9e45c0bff2cb4 status: local 1/10 remote 0/20

@4000000042d9e45c0bff309c end msg 6454822

@4000000042d9e45c0f6fd9d4 delivery 10: success: did_1+0+0/

@4000000042d9e45c0f6fe58c status: local 0/10 remote 0/20

@4000000042d9e45c0f6fe974 end msg 6454826

@4000000042d9e4c30e846094 starting delivery 11: msg 6454758 to local jeremy@server

@4000000042d9e4c30e847034 status: local 1/10 remote 0/20

@4000000042d9e4c33278c4cc delivery 11: success: did_1+0+0/

@4000000042d9e4c33278d084 status: local 0/10 remote 0/20

@4000000042d9e4c33278d46c end msg 6454758

@4000000042d9ea7f25e08a74 new msg 6454975

@4000000042d9ea7f25e0962c info msg 6454975: bytes 213 from <root@server.server> qp 27248 uid 0

@4000000042d9ea7f26632bdc end msg 6454975

@4000000042d9ed36335ccfb4 new msg 6457099

@4000000042d9ed36335cdb6c info msg 6457099: bytes 213 from <jeremy@server.server> qp 689 uid 1000

@4000000042d9ed370517370c starting delivery 12: msg 6457099 to remote root@server.server

@4000000042d9ed37051892b4 status: local 0/10 remote 1/20

@4000000042d9ed370920efdc delivery 12: failure: Sorry,_I_couldn't_find_any_host_named_server.server._(#5.1.2)/

@4000000042d9ed370920ff7c status: local 0/10 remote 0/20

@4000000042d9ed370da844ec bounce msg 6457099 qp 691

@4000000042d9ed370da850a4 end msg 6457099

@4000000042d9ed370db329fc new msg 6457104

@4000000042d9ed370db41c2c info msg 6457104: bytes 752 from <> qp 691 uid 206

@4000000042d9ed3710e48044 starting delivery 13: msg 6457104 to remote jeremy@server.server

@4000000042d9ed3710e8d1bc status: local 0/10 remote 1/20

@4000000042d9ed371d4a9a94 delivery 13: failure: Sorry,_I_couldn't_find_any_host_named_server.server._(#5.1.2)/

@4000000042d9ed371d4aa64c status: local 0/10 remote 0/20

@4000000042d9ed3727611bac bounce msg 6457104 qp 693

@4000000042d9ed3727612764 end msg 6457104

@4000000042d9ed37276dd194 new msg 6457109

@4000000042d9ed37276ec3c4 info msg 6457109: bytes 1200 from <#@[]> qp 693 uid 206

@4000000042d9ed373106396c starting delivery 14: msg 6457109 to local postmaster@server

@4000000042d9ed3731098914 status: local 1/10 remote 0/20

@4000000042d9ed3737d140d4 new msg 6457113

@4000000042d9ed3737d14c8c info msg 6457113: bytes 1299 from <#@[]> qp 696 uid 200

@4000000042d9ed3804c8e444 delivery 14: success: did_0+1+0/qp_696/

@4000000042d9ed3804cccc44 status: local 0/10 remote 0/20

@4000000042d9ed3804ce79f4 starting delivery 15: msg 6457113 to local jeremy@server

@4000000042d9ed3804cf2da4 status: local 1/10 remote 0/20

@4000000042d9ed3804d0a0bc end msg 6457109

@4000000042d9ed3808a733cc delivery 15: success: did_1+0+0/

@4000000042d9ed3808a73f84 status: local 0/10 remote 0/20

@4000000042d9ed3808a7436c end msg 6457113

@4000000042d9ed7832e2cd54 new msg 6457124

@4000000042d9ed7832e2d90c info msg 6457124: bytes 214 from <jeremy@server.server> qp 728 uid 1000

@4000000042d9ed783844b384 end msg 6457124

```

Any suggestions?

----------

## nms

I'm not at all familiar with Qmail, but it seem as if it assumes 'server.server' as hostname for local mail, and then fails to resolve that hostname (for obvious reasons) and hence cannot deliver the mails. Check settings for local hostname and similar. If you are only using it for local delivery you might want to check out ssmtp instead.

If you had posted logs from Postfix I probably would have been able to help a bit more, but I suspect there are Qmail gurus around here somewhere too.

----------

## irwinr

Well, qmail has definitely gotten me further than sendmail or postfix.  I'm able to send mail to external addresses, just not internally.  Is it possible that qmail is working just fine, and that the problem is actually something else?

I ran strace when trying to open the 'mail' application, and I notice theseL

```
open("/home/jeremy/.mailrc", O_RDONLY)  = -1 ENOENT (No such file or directory)

open("/var/mail/jeremy", O_RDONLY)      = -1 ENOENT (No such file or directory)
```

Those directories don't exist.  Is there a seperate program I have to install to handle deliverying mail to local users?  Or should qmail handle that?

-Jeremy

----------

## irwinr

Ok, qmail is definitely working, I found the directory where mail is being delivered, it's /home/user/.maildir....  Any ideas why my mail clients aren't checking that directory for new mail?

-Jeremy

----------

## irwinr

I tried setting the MAIL environment variable to /home/user/.maildir, but with no luck, that just cuases my mail client to give me the error:

```
mail: /home/jeremy/.maildir: Is a directory
```

I guess it's expecting a mbox style file?  What is going on here?  Why deliver mail to .maildir if mail clients can't read it?  Or am I missing something?

-Jeremy

----------

## nms

The .maildir format is mainly for IMAP servers, since the Mailbox format stores all messages in one file while IMAP wants one file for each message and can handle folders etc server-side. If you wish to keep the .maildir storage format, set up a working IMAPd (like Cyrus or Courier) and use a client that can fetch mail using IMAP instead of reading local mailspool.

The choice you have to make is basically if you want to enable IMAP for clients, with regards to diskspace and how many people will be using it. If you are the only user on the system and your favourite MUA (pine or whatever) won't speak IMAP, change your MTA (Qmail in your case) settings to use Mailbox with delivery to /var/mail/$user or whatever feels comfortable for you and your MUA. If, on the other hand there are several users receiving e-mail on your system and they will be accessing their e-mail using external MUAs like Outlook, Thunderbird or similar I would suggest going with IMAP, since at least from my perspective IMAP has a lot of advantages over POP3.

As usual, it's your own decision to make based on your situation. What works for you is your best choice, not what I or anyone else thinks.

----------

## irwinr

This is just odd for me, I've been using Gentoo for a while, but I am a long time RedHat/Fedora user.  With Fedora, pine, mail, imap, and pop3 all worked fine.  (I guess they were all using the mbox format?)

Anyhow, changed my USE flags to include "-maildir +mbox", ran emerge --newuse world, which rebuilt procmail. And updated the procmail config file to have it dump mail in /var/spool/mail/$LOGNAME  but for some reason mail is still being delivered to $HOME/.maildir

I have tried restarting qmail, not sure why it's still usingthe maildir

-Jeremy

----------

## rex123

The guy who wrote qmail (Dan Bernstein) invented maildir, so maildir is, unsurprisingly, what qmail uses. This is seen by most people as a Good Thing, and all the other MTAs started to support maildir format once they realised that it was worth it. It's also the Gentoo default (isn't it?), and, I think, this is another Good Thing.

My advice is to either ditch qmail or get to love maildir (and switch your USE flags back).

If you still want to ditch qmail, my next advice is to install exim. It's my favourite piece of software at the moment. Like Gentoo, it's a mystery at first, then you wonder how you would manage without it. But there don't seem to be many good Gentoo how-tos for exim. Perhaps I should write one.

----------

## kashani

.maildir is not primarily for IMAP as uw-imapd, the oldest IMAP server anyone uses, still refuses to support it. The idea behind .maildir was being able to drop an email as file in a dir to deliver mail instead of locking the spool and have to wait for the spool to be released in the case of simultaneous mail delivery. Also .maildir scales easily across NFS or shared storage whereas mbox does not. .maildir does have other scaling issues, it's brutal on the filesystem and inode usage, but overall it scales better in large systems.

qmail does not support mbox, only .maildir. Postfix, Sendmail, and Exim will support either. Sendmail support of .maildir is a bit funky as you have to use procmail to make it happen.

Assuming you plan to pop or imap your mail at some point we should also talk about those servers. Courier-imap supports only .maildir. uw-imap supports on mbox. Dovecot, I've never used it but some admins swear by it, can support both. Cyrus-imapd has it's own format so you'd only want to use it on a deidcated pop/imap system rather than your personal box. Or configure Mutt and Pine to access your mail through pop or imap.

When everything is said and done the whole .maildir vs mbox issues doesn't really matter so much on your personal box. I prefer .maildir because that's what I use at work and I use Courier-imap. Courier's new authlib stuff kickass when creating a virtual mail system. I also prefer Postfix FWIW.

In any case you can use either .maildir or mbox on a Gentoo system. For some reason mutt, pine, and many other CLI mail tools aren't configured to use .maildir by default which is annoying. Once you get past that everything works fine. 

kashani

----------

## FuzzyOne

Ok... i'm also one of those hopelessly stuck in the email vortex... searching the forums and wiki's, etc. get me nowhere.

I just need local mail in Gentoo.  I don't care how... but i need to see system mails sent to root by cron and everthing else using mail and pine.   (just like most other distro's).  What's the easiest way to set this up?  I don't want to have sendmail or a clone to listen to an open port either.

I've tried qmail with aliases, postfix, sendmail and ssmtp. nothing works.    The process hangs when i try to send email to root or some other local account.  I tried mbox then maidir format, still nothing.   Qmail would put messages into the mess folder but they stayed 'stuck' there.  Is there a HOWTO i'm missing?  All the info i've found on the net is for external emails and virtual hosts and the like... nothing about local mail.  

Any suggestions?

----------

