Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is IMAP, MTA and MDA

Status
Not open for further replies.

ssruprai

Programmer
Apr 24, 2002
16
IN
Hello,
I am really confused about what software I need to provide e-mail facility to my web site users on Linux (like hotmail.com).

There are many terms and software. I am unable to understand what software actually does what?

My questions are:

1. What is a mail server. Are MTAs also called mail servers or imap/pop servers are called mail servers?


2. What imap/pop server's job is? There are many servers: courier-imap, cyrus-imap, uw-imap. Do they need MTA to deliver mail?


3. What is the function of MTA? What is the difference between Mail Transfer Agent(MTA like sendmail, qmail) and Mail Delivery Agent(MDA like procmail)


Without these answers I don't know from where to begin and what software to use?

Sukhwinder Singh
 
A mail server is typically any program that can route SMTP formatted messages.

An MTA move mail across a network. An MDA receives mail from an MTA and delivers it to a recipient. Often, the MDA provides functionality for filtering mail (for spam elimination). And don't forget MUA (mail user agent) which allows someone to deal with mail interactively.

Basically, your MUA hands the mail off to your MTA, which then routes it to the destination MTA. The MTA on the destination server then hands the message to the local MDA for delivery to the users mailbox. The user then invokes his MUA to retrieve and read the mail.


IMAP and POP are methods for retrieving email from a mailbox after delivery. IMAP and POP as a standard part of the protocol support user authentication. POP is pretty primitive -- it's an old protocol. IMAP has extra functionality: mailbox subdirectories, handoff from one serve to another in distributed environments, etc. You still need an MTA or MTA+MDA to get the mail into the mailbox.

Keep in mind that many MTAs can include the functionality of the MDA. Qmail, for instance can act as its own MDA, or it can use procmail.

As far as what system to use, that is the subject of many Canon Wars. I prefer qmail because it is small and easy to configure, but can be a bit of a bear to install. It also supports the Maildir mailbox format, which I can use to do all kinds of interesting things programatically. If you decide to use Qmail, you will probably use courier-imap with it -- it seems to be the easiest to get working with Qmail.

If you are doing something similar to hotmail, you might want to look around to see if there are packaged installs to do what you want to do, including user management, mailbox limits, etc.
 
Thank you very much Sir for your help. You have explained the whole process very well. It has cleared almost all my doubts.

According to you whole process I think is, when a user composes a mail using his MUA like (Outlook) then MUA hands it off to MTA for delivery. MTA then it sends it to destination address where other MTA receives the Mail and forwards it to MDA which stores it in a Mailbox. Then through IMAP/POP we can retrieve that mail using our MUA.

MUA->SourceMTA->DestinationMTA->MDA->IMAP/POP->DestinationMUA

If I am right then there is no MDA at sender's end.

It will be a great help if you can also answer these questions:

1. Does MDA comes into picture when sending a mail?
2. Which software manages users, IMAP server or MTA. Is System account needed when courier /qmail is used?
3. Do both MTA and MDA need to support Maildir format?
4. Which software allows to arrange and manage mail using different folders, when maildir mailbox is used? IMAP server. MTA or MDA?
5. API to add/delete users using web interface (perl/php)is provided by MTA, MDA or IMAP server?
6.Does qmail/courier provide any web scripting language, like perl/php, support?
 
1.The MDA under almost all circumstances does not enter into message sending.

2. The IMAP server will authenticate users against whatever source it has been configured to use.

3. If you have an MDA separate from the MTA, the really only the MDA needs to understand the Maildir format. The MTA will just pass the message directly to the MDA.

4. Neither. The MDA puts mail in the "new" subdirectory of the Maildir. The MUA will manage it from there. A good example of this is the new version of Kmail. You can have folders into which you sort your mail (like the folders in Outlook). Kmail can store the messages in the MUA-side folders on your filesystem in a Maildir-format directory.

5. None of the above. That functionality is generally provided separately. There are many possible configurations for telling an MTA what messages to accept and for telling the MDA how to deliver them. Qmail, for example, uses its own configuration files as well as the authorization system of the server to determine where to put mail, but you can also patch qmail to use MySQL as its routing and authentication backend.

6. Not out of the box. There is an interesting web page titled the Qmail FreeBSD Mail Toaster ( It details the steps to provide a web server that provides SMTP, POP3, IMAP and ICAP (allows users to publish/share calendars, which we haven't talked about at all) along with a web interface for administrator configuration and user sending/receiving mail. It uses a MySQL backend for user information and authentication. Although the instructions are for installation on FreeBSD in particular, I personally know 2 people who got it running on Linux.
 
Thank you again Sir for helping me out. You explained everyting to me (without any incentive:). It was really a great help. You have answered all my questions.

So, according to you both MTA and IMAP/POP server have to be configured to use same authentication backend and mechnaism.
 
No necessarily authentication. The MTA (or MDA, if you use one separate from your MTA) will use the same user data source as the IMAP/POP3 server, but only to figure out whether it should accept the mail, and what to do with it once it does.
 
Hi,

Hope you don't mind another view on this.

It may be worth thinking about these processes in respect to the software you are using. As an example in the 'usual' dialup Microsurf world:

A use composes mail in outlook express (The MUA - mail user agent). Once finished and sent, the MUA will communicate with the ISPs MTA - using the SMTP protocol.

Let's say that this SMTP server service performing the role of the MTA - mail transfer agent - is running the *nix Sendmail program to do this (though it could be another like qmail or postfix). It routes the mail on to the destination server's MTA, also it's Sendmail program.

Once this final server receives the mail, the config determines what program to run to deliver the mail locally. In most *nix boxes, this MDA (mail delivry agent) is going to be the Procmail program. The procmail program is run for each local delivery, the default process is to place the mail in the recipient's mail spool (mailbox) but each users can have a 'procmail receipe' to process them specifically - spam filters, seperate into different folders etc.

Now, the mail is in the mailbox but it needs to be accessible by the recipient. If they can log directly onto the mail server, then they could use MUA programs like mutt or pine to read the mailbox(es) directly - mail user agents. If they are remote, then they will need to have the mail serverd in a more appropriate manner. POP3 and IMAP4 services running on the server will 'publish' the mailboxes using the POP and IMAP protocols respectively for the remote MUA. In this example, the recipient uses Outlook to download the mailbox contents from their ISP's mail server running the POP3 protocol.

As for authentication, it all depends upon the connection to the server. For ISP connections, authentication is often referenced by the POP/IMAP services to the RADIUS server that authenticates initial dialup logins. For a private network, the authenication may reference the servers password file. IN NT networks, it's referenced to the domains PDC etc. Generally, the POP or IMAP server will collect the username/password from the MUA and pass the details onto the local authenication services.

With Linux systems, PAMs are often involved - Pluggable Authenication Modules (I think?) which is a selection of modules that allow a system to authenticate against different authentication services. For example, a server may have PAMs for a local password file and for a local Kerberos server. When an authentication request comes in from a POP server, the PAMs may be configured to try and authenticate against the local password file, if there is no user in that list, then try the Kerberos server etc. Whereas, the authentication method on the same server for terminal logons may be only allow the use of the password file.

Hope this helps.
 
Just to add a bit more, if you want to run a service like 'hotmail' - ie. a webmail system - then there are web services that communicate with an IMAP server to present the MUA view in the browser. I think there are a few PHP applicatins for this - agsin, the PHP scripts being written to pass on the authentication information.
 
Hello,

I am really thankful to both of you. You have helped me to learn how e-mail works. Earlier these terms really confused me.

Mr. Norwich mentioned about PAM authentication. This is the problem I am facing now.I downloaded many imap/pop servers like UW IMAP, Cyrus IMAP and courier IMAP. UW IMAP server worked with Linux system account but it cannot be used to provide e-mail facility to website users who don't have system account.

Then I tried to use cyrus. I wasn't able to log in using test program (imtest) because of authentication problems. I received errors "user not found". I don't know how authentication works on Linux. And how to configure authentication and add new user accounts (not system accounts).

Anyway thanks once again Mr. sleipnir214 and Mr. Norwich .

Sukhwinder Singh
 
I think Cyrus and Courier have PAM authentication modules - but in this situation you may want to look at a database based system. Look for systems which store usernames and passwords in a MySQL database table or similar. Check out the authentication paragraph on this page:
 
Thanks once again. I did read that documentation. But I think I have to read it again and again...to understand how it works.
 
Here's a suggestion:



MTA - Qmail. Install it according to Life with qmail by David Sill. It'll take a couple hours the first time.

POP3- POP3d comes packed with qmail, it's fine.

MDA/ADMN - vpopmail, it actually is a management interface for qmail. It makes setting virtual users and domains a breeze. It also has a mysql auth option that works well.(
IMAP - Unless you've got some advanced mail requirements, I'd forget about IMAP. It can do a bit more than pop3 but takes more disk space and more processor intesive. (Most mail is still "Popped" not "IMAPed")

Webmail - Sqwebmail, written as part of the courier package - but fits well with the above setup. Also available at
Good luck, it's a challange!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top