Solved

Demystify electronic mail.

Posted on 1998-01-05
4
229 Views
Last Modified: 2010-03-18
null
0
Comment
Question by:msvenkat
  • 2
4 Comments
 
LVL 2

Expert Comment

by:mlev
Comment Utility
This is a fairly open-ended question, so I am giving this as a comment.
Email is transmitted to its destination through one or more
MTA (mail transport agents). (A "destination" is a mailbox here.
The recipient then may use a program to fetch their mail
from the mailbox, that's a different story.)
The most widely used (but not the only one) MTA is sendmail.
It can act both as a daemon for mail delivery and as a one-time
mail sending program.
The communication between MTA's is done in SMTP (a protocol written on top of TELNET, with just a couple of commands).
Here is a typical case:

Suppose you are me@here.net and you use pine or elm or mail
to send a message to them@there.net. Neither of those programs
actually does the communication to other hosts (at least not in their default configuration; maybe they can be configured to do so? I wouldn't know). They all invoke create a file containing
your message with appropriate headers and invoke "sendmail" to send it. Your local "sendmail" establishes a connection to host
there.net, TCP port 25 (the standard SMTP port) (name resolving is done transparently to the program with the gethostbyname() call, same as in telnet, ftp and many other programs, it's up to the OS to care whether it's via DNS or via /etc/hosts or via yellow pages.) At there.net, another "sendmail" (this time as a daemon) is listening to connections on port 25. It receives the message from your local "sendmail", determines its recipient is local, and appends the message to them's mailbox. In more complex cases, it is possible for a message to path through several MTA's (similar to IP packet routing).
It is possible to write your own mailer program that won't use a local MTA, but send the message directly to a remote MTA
(By the way, it is not necessary for your program to parse the recipient's address to determine what host to contact. It is possible to contact any MTA in the world and let it do the work. For example, my Netscape mailer always sends mail through mail.iname.com.)
Normally, a mail application incorporates mail sending capabilities and mail reading capabilities. As for mail reading, there are more possibilities, because there are different ways to access one's mailbox - local spool, POP, IMAP...
0
 
LVL 2

Expert Comment

by:mlev
Comment Utility
Actually, I just realized I was wrong about name resolving.
gethostbyname() is fine if there.net is a host, but if it's a domain, then you'll need a DNS query to find that domain's mail exchange server (where an MTA is running). Functions for that purpose are declared in <resolv.h>. You don't have to be running a DNS locally, just be able to access a DNS - i.e. have an appropriate line in /etc/resolv.conf. If you can type, e.g., "ftp ftp.gnu.ai.mit.edu" and get connected, then everything's okay.
If not, ask your ISP / LAN admin / whomever for a DNS address and put a line like this in your /etc/resolv.conf:
nameserver xx.yy.zz.tt
If you really want to set up a local DNS (though it is absolutely unnecessary for your purpose), DNS-HOWTO may be of help.
0
 
LVL 32

Accepted Solution

by:
jhance earned 400 total points
Comment Utility
How does an email work?

An email is an electronic transmission (usually following a defined standard) from a sender to a recipient.

What is the work of an email client and a server?

A CLIENT is the program that the sending or receiving persons use to compose and read their emails.  A server is a program which manages the delivery and queuing of mail to and from client programs.  Normally you will interact with a client program and IT will talk to a server program.

Is Pine, Elm email clients ?

Yes, these are examples of EMAIL clients.  Also you might add Eudora, Outlook, Netscape Mail, Pegasus, the ubiquitous unix mail.


Whose job is to establish the connection with the remote machine. Are the clients the one that establish connection with the remote server as specified on the address part of the mail or is it the server.

The client program will establish a connection with it's local mailer.  This is normally assigned by your service provider and may be something like mail.myhost.com or smtp.myhost.com.  This is a server that will accept your mail, determine what to do with it and then either deliver it, pass it off to another server that can deliver it, or bounce it back to you.

If it is the client then what is the job of the sendmaail deamon?

SENDMAIL is one example of a server program for handling internet mail.  Other examples would be SMAIL, MDAEMON, MS Exchange.

A mailer is usually something that handles some step in the delivery of mail.  On a unix system, sendmail may call other programs to deliver a message to the users mailbox, or route it through a dial-up modem.  These "helper" programs are often called mailers.  Sendmail itself has capabilities which also classify it as a mailer.

How should I find the destination machine address. Should I query the DNS server. Are there any simple functions for doing so.I don't even know whether a DNS server is running or not. If it is not how should I set one to run.

No, you don't query the DNS database yourself.  This is the job of the server (sendmail).  It finds out there joeblow.com is and what is the best way to get it there.

Moreover what happens when Pine/elm says that the "Message has been sent". Has it really sent the mail to the desired deestination ? I heard that it puts thhe mail in a spooling area. Isn't this misleading the sender? Is there any way to overcome this.

When pine/elm says it was sent, it means that it has handed the message off successfully to the server.  It does not mean that the message has been delivered to the recipient.  Under the current Internet mail system, there is NO SUCH THING as guaranteed mail delivery.

I am trying to build an email client and server. Do suggest me some good books/web sites holding info on the same.I have downloaded the necessary RFC's but they are difficult to comprehend.

I'd start with the client and take a look at the POP-3 (Post Office) Protocol.  It is very widely used and is quite simple to understand and implement.  You can connect you one like this:

telnet mymailhost.myserver.com 110

This will connect to the POP3 server (IP port 110) on your host.
0
 

Author Comment

by:msvenkat
Comment Utility
Thank you for the answer. I accept that sendmail is an MTA. In order to
test that I did'nt invoke the sendmail deamon. Even after that I am able to
deliver mails without any problem. But I tried that only within my host.
So please give a solution to my problem.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now