As seen in the /var/log/maillog when mail received or sent, sendmail saving mails to /var/spool/mail/$user and logging them as stat=Sent

When a user try to send or receive mail via imap it is not shown in ~$user/mail/


mail_location = maildir:~/mail:INBOX=~/mail/.INBOX

- Directory and file permissons are correct.

[root@mail ~]# ll -d /home/$user/mail
drwx------. 7 $user $user 4096 Oct 25 14:04 /home/$user/mail

There is no log about this problem in /var/log/maillog. I am wondering that how to send mail file to user's mail directory?

  • How have you integrated dovecot and sendmail? [sendmail's configuration changes] – AnFi Oct 25 '13 at 12:12
  • I didnt integrated them. I think procmail is doing this right? in my sendmail.mc i have these lines FEATURE(local_procmail, ', procmail -t -Y -a $h -d $u')dnl and MAILER(procmail) – efesaid Oct 25 '13 at 13:22

Andrzej's comment above is right on; dovecot isn't supposed to automagically do that. You will either need to tell sendmail to put the mail where dovecot is expecting it (or at least tell its local delivery agent to do that), or tell dovecot to expect it where sendmail puts it.

In my case, I do the latter; my dovecot.conf includes the line

mail_location = mbox:~/:INBOX=/var/spool/mail/%u

Edit: your sendmail is configured much as mine, using procmail as the local MDA. The man page for procmail suggests that /var/spool/mail/$user is the default place that procmail wil put incoming mail, if no other is provided:

                          system mailbox; both the system mailbox and the immediate directory it is in will be created  every
                          time procmail starts and either one is not present

so I repeat my point: you can either configure sendmail's MDA, procmail, to put incoming mail in /home/$user/mail/.INBOX, or you can configure dovecot to look in /var/spool/mail/$user. But you will have to do one of these things, it's not going to happen by magic.

| improve this answer | |

Sendmail reconfiguration for integration with dovecot


For using dovecot for delivery for existing OS use account consider adding the following lines to sendmail,mc file [sendmail.mc requires compilation into sendmail.cf]

FEATURE(`local_procmail', `/usr/local/libexec/dovecot/dovecot-lda',`/usr/local/libexec/dovecot/dovecot-lda -d $u')

Other possible sendmail reconfiguration options

  • making sendmail use dovecot only for UIDs no lesser than 1000
    [clasic delivery for system users/accounts, dovecot for normal users]
  • making sendmail support deliveries to existing virtual dovecot users [local_procmail based reconfiguration DOES NOT support it]
| improve this answer | |
  • how this setting effect mail_location behaviour defined in /etc/dovecot/conf.d/10-mail.conf ? – efesaid Oct 25 '13 at 17:03
  • local_procmail based integration will make sendmail use dovecot provided program (dovecot-lda) for deliveries to mailboxes. Dovecot-lda uses dovecot configuration (/etc/dovecot/conf.d/10-mail.conf too). – AnFi Oct 25 '13 at 17:51

My problem is INBOX file path was wrong. After changing mail_location from maildir to mbox and INBOX file to /var/spool/mail/%u it gave some permission errors.

[root]# vim /etc/dovecot/conf.d/10-mail.conf    
mail_location = mbox:~/:INBOX=/var/spool/mail/%u

Errors :

failed: Operation not permitted (egid=500)

And then setting permissions

[root]# chmod 0600 /var/mail*

[root]# service dovecot restart

It works well.

| improve this answer | |

Dovecot: INBOX as mbox in /var/mail/username and the rest of the mailboxes in Maildir

If you do not care about sieve filtering then you may configure dovecot to use /var/mail/username as inbox and keep the rest of the user's mailoxes in Maildir format.

It will make dovecot "see" messages delivered by MTA/sendmail to default location - no MTA/sendmail reconfiguration will be required.


| improve this answer | |

You need edit file: /etc/procmailrc

# file: /etc/procmailrc
# system-wide settings for procmail
SENDMAIL="/usr/sbin/sendmail -oi -t"
* ^X-Spam-Status: Yes
| improve this answer | |
  • Welcome to Server Fault. What did you change in that file? Can you quote or link to any docs that explain why this works? – chicks Jan 5 '17 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.