# howto setup webmail for 10000 and more users?

## sepp

Hi,

I was just wondering how websites like lycos, hotmail, gmx and co work.  As with 2.4 kernel you can only have 2^16 UIDs it's impossible that they setup up real accounts. But on the otherhand side, if you want to offer webmail with pop3 users need to have a system account, don't they?

How (and with which OSS) would you setup a webmail and pop3 service? I saw nice wemailers like horde imp but I don't know if this is the right way to go. 

I'm wainting for your opinions.

----------

## fleed

I think they use databases for users and their settings/messages, etc. So the maximum number of UIDs is not really relevant. Also, they use loads of computers so it's a bit more complex than what you'd have on a single PC.

----------

## Hmzaniac

with a user database like openLDAP for user storage, postfix (with LDAP support, courier-imap or cyrus (both with LDAP support) you'd come a long way. 

The only thing you'd most likely need to build yourself would be the webmail service, since most webmail services i've seen (imp/horde, squirrelmail and some others) don't really integrate very well with ldap. Ofcourse they can authenticate against nss_ldap or pam_ldap, but preferrably you'd want to store more info on these users in ldap (for example, quota, permissions, rights, subscriptions, wether the user has paid, etc.)

----------

## kashani

Having done it for 10mil, no you don't give them real accounts. Parsing an /etc/password, shadow, etc over 3-5k lines is going to tank your machine. It's all virtual accounts, in a database, uder one uid/gid.

Look at the Gentoo Virtual Mailhost  guide. It's the same idea, just larger. The nice thing is you can use the db table to split your users over mutiple storage arrays and other cool tricks. 

kashani

----------

## sepp

 *kashani wrote:*   

> Having done it for 10mil, no you don't give them real accounts. Parsing an /etc/password, shadow, etc over 3-5k lines is going to tank your machine. It's all virtual accounts, in a database, uder one uid/gid.
> 
> kashani

 

that's probably true for webmail ONLY accounts. but what happens if you want to offer people to have pop3 and smtp access aswell? if you want to check your email via pop3 you'll need to have a real account on the machine. how do they do this?

----------

## mst

I run and maintain systems which are built entirely on MySQL, postfix, courier-imap and squirrelmail. They provide SMTP, IMAP, POP3 and webmail services. All email users are purely virtual. Easy to set up and configure, there's a lot of referrence material at the Postfix website

----------

## Qball

one of the most biggest providers here use squirrelmail for there webmail (more providers do that) and it works great..

----------

## sepp

 *mst wrote:*   

> I run and maintain systems which are built entirely on MySQL, postfix, courier-imap and squirrelmail. They provide SMTP, IMAP, POP3 and webmail services.

 

do you run squirrelmail connected to a mysql database aswell? maybe even with spamassassin configured?

----------

## kashani

 *sepp wrote:*   

> 
> 
> that's probably true for webmail ONLY accounts. but what happens if you want to offer people to have pop3 and smtp access aswell? if you want to check your email via pop3 you'll need to have a real account on the machine. how do they do this?

 

For someone who is asking a number of basic questions about a topic they have little knowledge you're awfully opinionated. 

Here's the quide I mentioned that will answer the majority of your questions, as well as telling you how to build such a system on a smaller scale. Figuring out how to deal with multiple I/O paths, db replication, clustering, and load balancing to support 10k users is left as an excersize for the reader.

http://www.gentoo.org/doc/en/virt-mail-howto.xml

kashani

----------

## sepp

 *kashani wrote:*   

> 
> 
> Here's the quide I mentioned that will answer the majority of your questions, as well as telling you how to build such a system on a smaller scale. Figuring out how to deal with multiple I/O paths, db replication, clustering, and load balancing to support 10k users is left as an excersize for the reader.
> 
> http://www.gentoo.org/doc/en/virt-mail-howto.xml
> ...

 

read this one. it seems to be what i was looking for except that all email accounts are in one database. it would be much nicer to have a seperate table for each domain.

----------

## patan

 *sepp wrote:*   

> 
> 
> read this one. it seems to be what i was looking for except that all email accounts are in one database. it would be much nicer to have a seperate table for each domain.

 

This might not suit you since I don't know why you want this, but take a look at VIEWS

http://www.postgresql.org/docs/view.php?version=7.0&idoc=1&file=rules19478.htm

MySQL doesn't support VIEWS yet so you'd have to use Postgres or another database that does.

----------

## sepp

 *patan wrote:*   

>  *sepp wrote:*   
> 
> read this one. it seems to be what i was looking for except that all email accounts are in one database. it would be much nicer to have a seperate table for each domain. 
> 
> This might not suit you since I don't know why you want this, but take a look at VIEWS
> ...

 

I want this so I can give each domain owner the right to setup and maintain his email accounts.

----------

## patan

 *sepp wrote:*   

> 
> 
> I want this so I can give each domain owner the right to setup and maintain his email accounts.

 

What kind of interface are you going to use to do this? You can just add a field called "domainid" to the tables and let each domain owner edit users which has their id.

----------

## sepp

 *patan wrote:*   

> 
> 
> What kind of interface are you going to use to do this? You can just add a field called "domainid" to the tables and let each domain owner edit users which has their id.

 

I'm going to setup a php interface.

the domainid thing would be ok for changing user settings and creating new ones. but each domain admin will see all the other accounts on the other domains.  that's not good.

----------

## patan

 *sepp wrote:*   

> 
> 
> I'm going to setup a php interface.
> 
> the domainid thing would be ok for changing user settings and creating new ones. but each domain admin will see all the other accounts on the other domains.  that's not good.

 

But you'd have to filter the other ones out. For example if domain_id 1 = example.org and domain_id =2 is example.com. When the administrator for example.com is editing his users the system should issue a "select * from users where domain_id = 2" then he will only see his own users.

----------

