# Dovecot and incoming server with strange results.



## Angel Hess (May 5, 2021)

I only started using Dovecot recently and finally got it to function via internet and email clients. But I have a question. If setup Dovecot as IMAP server, the inbox is stuck in itself, I mean if I create a new folder in the inbox from within the email client, and then move one email message from the inbox to the folder, the email moves to the folder, then if I refresh and get new messages the server gets the original email and now there a duplicate email in the inbox and in the new folder. But, if I do the same thing with POP3, there is no issue and the folder functions correctly and no duplicates after moving email to folder with POP3. Why is this happening? Is it normal? How do I fix the IMAP to register the email moved to folder and not make duplicate? I am undecided which I will use for the final server, IMAP, POP3, etc. Of what I know of IMAP I would assume this problem would be more likely to happen with POP3 so I think its funny I am having a folder issue with IMAP.


----------



## SirDice (May 5, 2021)

POP3 typically downloads the messages locally and deletes them on the server, with IMAP everything stays on the server. Check if the account that dovecot runs on actually has write access to the mail folders, because it sounds like the service itself doesn't have the correct permissions to handle the mailboxes.


----------



## Angel Hess (May 5, 2021)

Ok I've tried to adjust permissions by adding the Dovecot run user to the owners group of the mail directory, and settings in conf file the following, mail_uid, mail_gid; and getting the same results. Is there something more in the config file I am missing?


----------



## Angel Hess (May 5, 2021)

Additionally I can't seem to delete emails either. So it seems it is a permission issue...
The directory I am using for the inbox is the default one that freebsd uses, /var/mail, etc...


----------



## Geezer (May 5, 2021)

Dovecot might be set up for IMAP, but are you sure sendmail (or whatever you are using) is not delivering to mbox format?


----------



## Angel Hess (May 5, 2021)

Geezer said:


> Dovecot might be set up for IMAP, but are you sure sendmail (or whatever you are using) is not delivering to mbox format?


Yes its likely mbox format; the default. So what format is required for IMAP to function best? I am not using postfix. I am using sendmail. Does sendmail offer different than mbox? I don't want to use a different delivery program. I don't want to use postfix!


----------



## covacat (May 5, 2021)

Geezer said:


> Dovecot might be set up for IMAP, but are you sure sendmail (or whatever you are using) is not delivering to mbox format?


dovecot supports mbox format.
@OP
you can use sendmail + dovecot-lda / sendmail and use maildir

```
Mlocal,         P=/usr/local/libexec/dovecot/deliver, F=lsDFMAw5:/|@qSPhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
                T=DNS/RFC822/X-Unix,
                A=/usr/local/libexec/dovecot/deliver -d $u
```
replace Mlocal with the above in sendmail.cf


----------



## Geezer (May 5, 2021)

You may need procmail as well as sendmail so your mail get delivered in maildir format.

`FEATURE(local_procmail)dnl`


----------



## Angel Hess (May 5, 2021)

Geezer said:


> You may need procmail as well as sendmail so your mail get delivered in maildir format.
> 
> `FEATURE(local_procmail)dnl`


No. Definitely not going to be using procmail. Do I need maildir and mbox, is this required to function best? Can't just use mbox?


----------



## covacat (May 5, 2021)

you don't need procmail. the dovecot package contains all you need.

```
pkg which /usr/local/libexec/dovecot/deliver
/usr/local/libexec/dovecot/deliver was installed by package dovecot-2.3.13
```


----------



## VladiBG (May 5, 2021)

Can you show your current configuration? 
`doveconf -a`


----------



## Geezer (May 5, 2021)

Angel Hess said:


> No. Definitely not going to be using procmail. Do I need maildir and mbox, is this required to function best? Can't just use mbox?


No you can't use both, that is what you are doing now, and why it is not working.
And you cannot use mbox if you want IMAP. You can't have the flexibility of IMAP with the inflexibility of mbox.


----------



## covacat (May 5, 2021)

Geezer said:


> No you can't use both, that is what you are doing now, and why it is not working.
> And you cannot use mbox if you want IMAP. You can't have the flexibility of IMAP with the inflexibility of mbox.


you CAN use imap and mbox. it just sucks but it is very possible. mbox is supported by dovecot too. 





__





						Mbox Configuration — Dovecot documentation
					





					doc.dovecot.org


----------



## Geezer (May 5, 2021)

__





						LDA/Sendmail - Dovecot Wiki
					





					wiki2.dovecot.org
				





covacat said:


> you CAN use imap and mbox. it just sucks but it is very possible. mbox is supported by dovecot too.


Well lots of things may be possible but hopelessly not worth it.


----------

