Okay, there are actually 3 pieces to the puzzle: MTA's, MDA's and MUA's.
MTA - Mail Transfer Agent
MDA - Mail Delivery Agent
MUA - Mail User Agent
The MUA starts the process. This is the program that sends the message. Thunderbird, Ximian are good examples of MUA's. These programs can both send a message, and receive inbound messages for local store.
When a MUA sends a message, it goes to the MTA. The MTA has a choice, it can either deliver the message, if the recipient is "local", or, it can forward the message to the next MTA, which then has to "ask" the same question. This goes on "forever" (servers do check for looping, though), until the final destination is reached. (Actually, modern servers are supposed to send directly to the destination server now, so usually there's only 1 or 2 transfers)
So now, lets assume that the final MTA has been contacted and is now receiving the message. Through a process dependent to the server itself, it will somehow store the message. This can be as simple as saving the message into a directory (eg: /var/spool/user). At this point, the process of saving to that spool directory, the server becomes the MDA, that is, it's deliverying the message to the user's spool.
Of course, this is only partially true for this type of mail system. What about POP3 users? Even for pop3, the message needs to be stored into a spool on the server. This is done by the MDA. Then, POP3 becomes the remote MDA to send the message to the MUA, which then, in turn is a local MDA, for local storage.
I'll try and diagram this out:
Code:
MUA -----> MTA 1
-----> MTA 2
(change role to MDA?)
+ Send to some other program, like procmail
+ Or (like sendmail) save it directly to a spool (/var/spool/user)
A good way to understand this is to think of the Postal system. Postal carriers (people) pick up mail and take it to the Post office, which then transports it to another post office, for local delivery. Then, a postal carrier becomes to the "delivery agent", by bringing the mail right to your house. Your mailbox is your MUA.