I'm trying to understand how all the components of a mail server fit together.
- I understand that the SMTP server is necessary to send emails.
- In terms of accessing email, I'll setup a webmail client but do not need access through a desktop client.
So my question is: do I need an IMAP server in this case? or can the webmail client somehow link directly to the SMTP to send and read emails?
For setting up your email server and webmail, you need two things:
The webmail will not actually be receiving the messages, it will only read or fetch them from somewhere. It is the smtp server (usually the same as the one used to send) that will receive messages and store them somewhere (on disk, but could also be in some database) through the use of an MDA (Message Delivery Agent). Then you need a way for you webmail to access that somewhere.
Depending on your setup and the webmail client you want to use, there are various options:
If you don't want IMAP nor POP3, you could use the disk direct access solution, but you need a webmail software that can read either
mbox
ormaildir
email storage. Those are the 2 most popular ways of storing messages on a UNIX host.mbox
is a single file containing all messages,maildir
is a directory with subdirectories with each messages as a separate file.maildir
format is the most common and powerful.Such a webmail client is not very common, you'd probably have to develop it yourself (or a plugin for other existing webmail software). Still, there is one I know capable of doing that it is SqWebMail, included with courier email server suite.
DB message storage is a possibility, but probably only used in very large setup.
You might also be interested by this post on StackOverflow.
This is related to something I answered earlier today:
Mails are not receiving in Squirrelmail?
Except you're using Roundcube instead of Squirrelmail.
Also, take a look at:
http://wiki.mutt.org/?MailConcept
as an overview of the various components of the mail system (i.e., MTA, MUA, MDA).
Roundcube, if I recall, is purely an IMAP client, maybe some POP3, I don't recall. In either case, you will need an IMAP server acting as the MDA.
That said, I can't think of any web-based mail client that will access the legacy mail spools off hand. It would be possible to write one, but that feels somewhat inflexible, given that we've already invented IMAP, which takes care of issues like simultaneous access on the spool file, etc. If you're running a for-real mail system in this day and age, you will want to use an MDA supporting something like IMAP.
There are also big, "groupware" systems like Horde or Zimbra. These will give you the whole mail system (plus other groupware applications) in one big package, so, in a sense, you'd only be installing one piece of software. But, under the hood, the internals will have the mail architecture concept I mentioned above, with an MTA -> MDA -> MUA.
No. A client that receives via SMTP is not a client anymore but a server. While there's no technical reason you can't have an SMTP server with a web interface for accessing messages, this is not how clients work. Also bear in mind that SMTP is a push protocol, so while another server could certainly send messages on to your "client", that "client" could net fetch messages.