PDA

View Full Version : Multiple Accounts with Dovecot?


daviddoria
2007-12-26, 04:44 PM CST
I am using getmail to deliver several pop3 accounts to /mail/maildir/user1, /mail/maildir/user2 etc. that i would like to login (pop3) to with usernames user1 and user2.

However, in dovecot.conf, I only have one place to put the "mailbox", namely:
mail_location=

so i put:

mail_location=maildir:/mail/.maildir/%u

but I cant seem to get any mail this way, the mail client just seems to think there is no mail.

What am I missing here?

Thanks,

David

stevea
2007-12-26, 06:51 PM CST
Whaaa ?

getmail pulls mail from a pop3 client server and feeds it into your local MTA (sendmail, postfix ...)
Then MTA delivers mail the MBOX or the maildir structure (I would strongly prefer Maildir) or forwards it.
Then docecot or other client server makes the mail available as imap or pop3.

so i put:

mail_location=maildir:/mail/.maildir/%u

This is where dovecot gets mail FROM so it can serve to your thunderbird or outlook client. It does NOT control where mail is put.
==
You need to devise your MTA configuration so it has aliases to each email account.

For postfix I .... add these lines to /etc/postfix/virtual
root stevea@localhost
postmaster stevea@localhost
steve-a stevea@localhost
brenda brenda@localhost

Then I creates virtual.db from virtual
postmap /etc/postfix/virtual
==

scottro
2007-12-26, 07:14 PM CST
If getmail is already doing the distribution, why would he have to worry about the MTA? It would seem that that part is already done. As far as I know (I haven't used dovecot in awhile though) dovecot will authenticate however you choose in the configuration, then for dovecot it should be ~/Maildir or the like. (I'm assuming each Maildir is a separate user with their own $HOME directory. )

If that's correct and each Maildir is for a separate user then this (https://help.ubuntu.com/community/Dovecot) might help though it's for Ubuntu.

If that's the case, I don't see the need for an MTA. However if these separate Maildir directories are for one user, then I think stevea is on the right track and I'm derailed. :)

dwaegerle
2007-12-26, 07:30 PM CST
I am new to fedora and i had a question about dual booting with windows xp how do you set that up on one hard drive?

stevea
2007-12-26, 07:43 PM CST
If getmail is already doing the distribution, why would he have to worry about the MTA? It would seem that that part is already done. As far as I know (I haven't used dovecot in awhile though) dovecot will authenticate however you choose in the configuration, then for dovecot it should be ~/Maildir or the like. (I'm assuming each Maildir is a separate user with their own $HOME directory. )

If that's correct and each Maildir is for a separate user then this (https://help.ubuntu.com/community/Dovecot) might help though it's for Ubuntu.

If that's the case, I don't see the need for an MTA. However if these separate Maildir directories are for one user, then I think stevea is on the right track and I'm derailed. :)

He is NOT using maildir he' using mbox.

The problem (as I understand it) is that he uses getmail (like fetchmail) to fetch meil from several pop3 accounts, then getmail feeds this mail into his local MTA. The MTA should separate the incoming mail into account, *if* he has proper MTA config, but he doesn't. The other accounts mails are either lost or sent to the same mbox. You cannot fix the problem once all the mail is in the same local mbox (or maildir). That's too late. I believe you have to config the local MTA to deliver the several external accounts to different local accounts.

Possible I'm misunderstanding the question, but the only place where a stream of smtp's are switched to several accounts is in the MTA.

daviddoria
2007-12-26, 07:46 PM CST
It seems to me that getmail will put the mail from each remote pop3 account wherever i want it to. The problem lies in dovecot not knowing which directory to get the mail from when a user logs in. Do you see what i'm saying?

stevea
2007-12-26, 08:06 PM CST
I am new to fedora and i had a question about dual booting with windows xp how do you set that up on one hard drive?

You need to start your own thread or else search thru the forum (search tab, "dual boot" should do it.

In brief,
Install Win
Install Fedora
Verify Fedora is bootable, revise /boot/grub/grub.conf to allow Win boot.

You may have other methods if you install ona removeable USB for example.

daviddoria
2007-12-26, 08:53 PM CST
Ok guys this is starting to be very annoying.

in /etc/dovecot.conf I have :

mail_location=maildir:/home/%u/Maildir

for getmail, i am using:

[destination]
type=MDA_external
path=/usr/sbin/sendmail

in /etc/postfix/main.cf i have:
home_mailbox = Maildir/

when i run getmail, i get:

Delivery error (command sendmail 6772 error (64, ))
msg 21/21 (2449 bytes), delivery error (command sendmail 6772 error (64, ))
1 messages (2449 bytes) retrieved, 20 skipped

and it doesn't seem to deliver the message anywhere, and when i run getmail again, the 1 message seems to still be there and gets downloaded again

i have both /home/usr1/Maildir and /home/usr2/Maildir set to a+rwx for now for testing purposes

what else can i do???

scottro
2007-12-26, 09:44 PM CST
Ok, hold on, I think you'll confuse both stevea and myself.

Getmail is feeding to sendmail. Didn't you say you had getmail going directly to the maildir. (stevea, that's why I thought he was using maildir format, because of the terminology in the first post.)

You're feeding getmail to postfix. That's fine. Is postfix definitely configured as your MTA? If not, then you might be running into other problems. If it is, then the sendmail binary should be pointing to postfix. Assuming that it is, when did you start getting the getmail error? That is, what changes did you make to getmail that made that error start happening. (Always a good idea, when changing configuration files, to back it up before changing it--DO NOT trust your memory.) :)

So before you even look at Dovcot, you're going to have to figure out what's wrong with postfix and sendmail and getmail.

Also, it will help us if you're a bit more specific. stevea, I don't know if you're familiar with getmail (a great program, I much prefer it to fetchmail). In a case like this, I'm not even sure why you're feeding it to an MTA.

Is that a change you made? If so, can you put it back?

I ~think~ that for what you're trying to accomplish, you want getmail to put it right into the $HOME/Maildir/. Then, have Doveco get it from there. However, at present, we're now dealing with two separate issues. We have to fix the getmail one first, as otherwse, there will be nothing there for the users get, whether Dovecot's going to the right place or not. :)

daviddoria
2007-12-27, 06:34 AM CST
haha sorry for the confusion

Originally I was trying to get the mail with getmail and put it directly into several maildirs. After more reading, it seemed like i had to go through postfix to accomplish this several maildirs idea.

So first, how are sendmail and postfix related? How do i make sure postfix is setup as my MDA? How do I check sendmail settings?

Initially I think the problem was I didn't know how to have dovecot get mail out of a particular directory when a particular user logged in. If someone can explain how to do that I suppose I could go back to having getmail deliver directlty to the maildirs.

David

scottro
2007-12-27, 07:27 AM CST
Well, you're looking at it in the wrong order. Ok, doesn't each user have their own getmail crontab which puts it in their $HOME/Maildir (before you changed the sendmail postfix thingie?).

I would first put that back, and leave sendmail/postfix out of the equation. In a nutshell, they're both MTA's, heavy duty mail transfer agents which require some work to setup properly. Because Fedora uses sendmail as its agent of choice, that's what you're using. Although you might have postfix on your system, or even running, if you have told getmail to give it to sendmail, that's what it's doing, and sendmail is probably the more difficult to configure--in my opinion anyway, sendmail fans often disagree.

At any rate, it shouldn't be necessary. First, change getmail back to the local delivery thing, just putting it in the maildir. If that works, then we'll work on Dovecot. At this point, there's nothing for Dovecot to give the users though.

daviddoria
2007-12-27, 07:31 AM CST
ok , its put back. I have sucessfully delivered a message to /mail/user1/new and /mail/user2/new

now how do i have user1 login to dovecot pop3 and get his mail and user2 login to dovecot pop3 and get his mail??

I have in /etc/dovecot.conf :
mail_location = /mail/%u
and i have also tried
mail_location = /mail/%n

I have a+rwx on /mail/user1 and /mail/user2

Sorry for the trouble, but i was very confused at the beginning myself - you guys have been a great help!

scottro
2007-12-27, 02:36 PM CST
Ok, I'm buried at work, I might get a chance to look more deeply into this tomorrow.

However, let's confirm. Is getmail going to a mbox or a maildir?

Re your apology, that's Ok, we've all been there done that--well, I shouldn't speak for stevea, but I have, anyway. :)

Alright, so now the issue to have dovecot grab it from the mailbox--again, let us know if it's maildir or mbox.

daviddoria
2007-12-27, 04:44 PM CST
its a maildir - i heard that was the most flexible, and least likely (or impossible) to get corrupted because each email is a separate file.

getmail is delivering them properly to /mail/usr1/new and /mail/usr2/new (i mean i've set it just to /mail/usr1 and /mail/usr2, i'm just saying the mail actually appears in /mail/usr1/new etc.)

So now I need dovecot to get the mail from the folder name that is the same as the pop3 login name (which are actual accounts on the linux machine). I have set mail_location = /mail/%u in /etc/dovecot.conf but that doesn't seem to work, the remote mail clients just seem to think there is no new mail.

Please let me know if you think of anything.

Thanks,

Dave

daviddoria
2007-12-30, 04:01 PM CST
so it seems i can get the mail with imap for multiple dovecot users - can you not do it with pop3 though?