Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/

/etc/dovecot/conf.d/10-mail.conf

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?

share|improve this question
    
How have you integrated dovecot and sendmail? [sendmail's configuration changes] –  Andrzej A. Filip 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

4 Answers 4

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:

   /var/spool/mail/$LOGNAME
                          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.

share|improve this answer

Sendmail reconfiguration for integration with dovecot

http://wiki2.dovecot.org/LDA/Sendmail

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')
MODIFY_MAILER_FLAGS(`LOCAL', `-f')

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]
share|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). –  Andrzej A. Filip Oct 25 '13 at 17:51
up vote 0 down vote accepted

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.

share|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.

http://wiki2.dovecot.org/Namespaces#Mixed_mbox_and_Maildir

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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