The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => The Orphanage => Topic started by: Robert Collins on August 11, 2005, 03:59:57 PM

Title: EMAIL
Post by: Robert Collins on August 11, 2005, 03:59:57 PM
Well, as usual, my mind is gone again and I can't for the likes of me get it straight in my head.

What is the difference between the following?

SMTP Server
SMTP Client

POP3 Server
POP3 Client

I want to make my own Email Server, the application that waits for a connection until it receives some mail. in otherwords the opposite of Outlook. I can't remember which one of the above it is. :red
Title: Re: EMAIL
Post by: Tedd on August 11, 2005, 04:44:15 PM
(E)SMTP is for sending mail.
POP3 and IMAP4 are for receiving.
:bg

ie. outlook sends out emails using esmtp to give the mails to the server (for it to pass them through the network), and receives them from the (usually same) server with pop3 or imap4.

So your server will probably have to implement both sending and receiving?
imap has much better features and is mostly what's used now, but obviously it's quite a bit more work to program than pop3 :wink
Title: Re: EMAIL
Post by: Robert Collins on August 11, 2005, 04:58:51 PM
So, do I conclude from your reply that the server I want to make will be a pop3 server and it sits and listens on port 25? When it gets incoming mail it stores it up in a save area until a pop3 client (such as Outlook) request any mail to be sent to it.
Title: Re: EMAIL
Post by: P1 on August 11, 2005, 06:10:40 PM
SMTP & POP3 are protocols.  POP3 is a client to Server protocol.  SMTP is server to server protocol.  Thought some clients act like an server and SMTP mail directly to the destination server.

Client usually resides on the local computer of the user.

Server is the gateway MTA ( Message Transfer Agent ) between the client and the destination server / client pair.

Regards,  P1  :8)
Title: Re: EMAIL
Post by: P1 on August 11, 2005, 06:23:34 PM
Quote from: Robert Collins on August 11, 2005, 04:58:51 PM
So, do I conclude from your reply that the server I want to make will be a pop3 server and it sits and listens on port 25? When it gets incoming mail it stores it up in a save area until a pop3 client (such as Outlook) request any mail to be sent to it.
POP3 gets the e-mail from the client to the Server ( Works in reverse as well. ), then the Server, SMTPs the e-mail to the destination Server, which then POP3 relays the Message to the local client / user.

Port 25 is part of the SMTP protocol for server to server transfer of e-mail.

So you need both protocols on the Server to act as a complete MTA.

( Implied that Software runs on a hardware platform.)
Software        protocol    Software        protocol             Software        protocol         Software     
Local Client <> POP3 <> Local Server <> SMTP <> Destination Server <> POP3 <> Destination Client

Regards,  P1  :8)
Title: Re: EMAIL
Post by: Robert Collins on August 11, 2005, 06:34:34 PM
I appreciate your replys but still I seem to be missing the que. I think your replys are more involved than what I am asking for now. I'm not concerned about the theory (not mentally ready for it) because I am not going to get heavy into this at this time. I just want to do a quickie for now and will worry about details later. So, let me ask my question this way:

When someone sends me an email I use Outlook (and I know Outook is a client) to get that message from my email server. Question....What is the type of server where the email is waiting for me to request it?

Is it a pop3 server on port 25
Is it a pop3 server on port 110
Is it a smtp server on port 25
Is it a smtp server on port 110

I only want to know what type of server it is and the port it is listenening on.

Please excuse my ignorance over this but I seem to be in a turmoil. 
Title: Re: EMAIL
Post by: P1 on August 11, 2005, 08:20:54 PM
Outlook ( Local Client ) talks to ( Sends Mail ) & listens ( Receives Mail ) on the POP3 protocol ( Port 110 ) to the Local Server.
Local Server talks to ( Sends Mail ) & listens ( Receives Mail ) on the SMTP protocol ( Port 25 ) to the Destination Server.

Outlook does not use SMTP protocol ( Port 25 ) to talk to ( Sends Mail ) or listens ( Receives Mail ) to either Local Server or Destination Server.

Quote
Is it a pop3 server on port 25 - No
Is it a pop3 server on port 110 - Yes
Is it a smtp server on port 25 - Yes
Is it a smtp server on port 110 - No

Does the server software use both POP3 and SMTP protocols to act as a MTA?  Yes!  POP3 to communicate to the clients.  SMTP to communicate to the other servers.

POP3 = Local postal carrier from downtown to the house.  Postal carrier ONLY works with their local post office.
SMTP = Mail trucks going from post office to post office.  Truck drivers never go to your house.


Regards,  P1  :8)
Title: Re: EMAIL
Post by: Mark Jones on August 11, 2005, 09:18:14 PM
Aaaaha! But what if a truck has to go say, from New York to Sydney?  :green
Title: Re: EMAIL
Post by: Robert Collins on August 11, 2005, 09:31:50 PM
Thanks. I'm a little confused about the following:

Quote
Outlook ( Local Client ) talks to ( Sends Mail ) & listens ( Receives Mail ) on the POP3 protocol ( Port 110 ) to the Local Server.
Local Server talks to ( Sends Mail ) & listens ( Receives Mail ) on the SMTP protocol ( Port 25 ) to the Destination Server.

What is this Local Server and port 110 you mention above?

My understanding of the term listen is when a socket is in the listening mode (just waiting for a connection). But Outlook doesn't sit around and wait in a listen mode to receive mail; it only receives mail (assuming I do not have it auto check for mail) if I request it to do so. This means Outlook initiates the connection(not listening) to a mail server(listening) to see if there is any mail.

If I send mail to someone Outlook sends that mail to my IPS' mail server (SMTP Server listening on port 25).  I know this because I just set up a quickie program listening on port 25 and it got the connection from Outlook. All I had to do was go into Outlook and change the address of the outgoing mail (SMTP) to point to my home made application. This tells me that I can point to any address and so long as there is a program at that address listening on port 25 it will get the mail for Outlook.

If I make a program and have it listen on port 110 that program will receive the email on port 110 from the server if I request the server to send it to me. Now isn't that server the same server that I just sent email to (only on a different port)?

So, where does this Local Server enter into this senario? Is it hidden and I don't see it?
Title: Re: EMAIL
Post by: Robert Collins on August 11, 2005, 10:26:33 PM
Outlook: Send email to someone@somewhere.com--->Outlook connects to smtp.email.msn.com on port 25
and sends the email using SMTP protocol. Now, once my email smtp server gets the email from me it then
fowards it on to the destination (someone@somewhere.com).

From the above, does my smtp server connect to another smtp server and how does it know what the name
of that server is? Does it look for the name server(s) that host that domain? Is it like the browser
connecting to www.somewebsite.com and somewhere along the line that name must be resolved to an
address? For example, if you send me mail at robert@futureedge.com where does that email address
get translated into "plus1.host4u.net" because that is where it winds up at? Then I have to use
Outlook and connect to the pop3 server at that location to get the mail.

Here's my situation. I just bought a domain name and got it registered. I am hosting that domain
myself on my home PC. OK so far. When I use IE on another PC and type in www.my_new_domain.com
I get connected to my HTTP server running on my other PC. This I understand.

But now, I want to also have a Mail server so that when you send mail to bob@my_new_domain.com I
want the mail to wind up at my home mail server. So far, that doesn't work. Am I getting into something
that is beyond hope?   
Title: Re: EMAIL
Post by: P1 on August 11, 2005, 11:21:38 PM
Quote from: Robert Collins on August 11, 2005, 09:31:50 PM
What is this Local Server and port 110 you mention above? 
There are a number of pieces of software that does this.  Exchange, Lotus Notes, etc.

Quote from: Robert Collins on August 11, 2005, 09:31:50 PM
My understanding of the term listen is when a socket is in the listening mode (just waiting for a connection). But Outlook doesn't sit around and wait in a listen mode to receive mail; it only receives mail (assuming I do not have it auto check for mail) if I request it to do so. This means Outlook initiates the connection(not listening) to a mail server(listening) to see if there is any mail.
Your correct!  Listen was a general term in this case.  As far as Port Listening, the server does that.   Outlook technically polls for new mail at the server with the POP3 protocol.

Quote from: Robert Collins on August 11, 2005, 09:31:50 PM
If I send mail to someone Outlook sends that mail to my IPS' mail server (SMTP Server listening on port 25) Not True, POP3 on Port 110, in this case. I know this because I just set up a quickie program listening on port 25 and it got the connection from Outlook. Was it Outlook or your ISP's e-mail server?  You have a full time internet connection.  Check question: What IP address open the connection?  All I had to do was go into Outlook and change the address of the outgoing mail (SMTP) to point to my home made application. This tells me that I can point to any address and so long as there is a program at that address listening on port 25 it will get the mail for Outlook.
Outlook normally uses MAPI(Exchange), POP3, IMAP, HTTP, or other role based protocol, but not SMTP.  It was your ISP's E-Mail server that relay the e-mail back to you/to the other SMTP server, not Outlook.  When Outlook has an open POP3 connection, it looks like real time.  Unplug your computer from the internet and retry your test.  And you will find that Outlook is not the one hooking up.

Quote from: Robert Collins on August 11, 2005, 09:31:50 PM
If I make a program and have it listen on port 110 that program will receive the email on port 110 from the server [ should be client, not server ]  if I request  the server to send it to me.
Mixed Question.  If your program listens, it's the server.  See above, where I agreed with you.  "I request" is a client initiated action.

Quote from: Robert Collins on August 11, 2005, 09:31:50 PM
Now isn't that server the same server that I just sent email to (only on a different port)?
Yes, but it's not a different port.  Client/Server comunications are over POP3 ( Port 110 ).

Quote from: Robert Collins on August 11, 2005, 09:31:50 PM
So, where does this Local Server enter into this senario? Is it hidden and I don't see it?
In this case, Local means your Local ISP's E-Mail server that queues mail for you, while you are off-line.

Study the RFCs for POP3 and SMTP to understanding the roles and purposes of the e-mail traffic flow we are discussing.

Regards,  P1  :8)
Title: Re: EMAIL
Post by: P1 on August 11, 2005, 11:24:14 PM
Quote from: Mark Jones on August 11, 2005, 09:18:14 PM
Aaaaha! But what if a truck has to go say, from New York to Sydney?  :green
But the airplane does not land at your house either.   :naughty: 

from New York to Sydney, use planes = Internet routers over fiber optics.

Regards,  P1  :8)
Title: Re: EMAIL
Post by: P1 on August 11, 2005, 11:26:06 PM
Quote from: Robert Collins on August 11, 2005, 10:26:33 PM
Outlook: Send email to someone@somewhere.com--->Outlook connects to smtp.email.msn.com on port 25
and sends the email using SMTP protocol. Now, once my email smtp server gets the email from me it then
fowards it on to the destination (someone@somewhere.com).

From the above, does my smtp server connect to another smtp server and how does it know what the name
of that server is? Does it look for the name server(s) that host that domain? Is it like the browser
connecting to www.somewebsite.com and somewhere along the line that name must be resolved to an
address? For example, if you send me mail at robert@futureedge.com where does that email address
get translated into "plus1.host4u.net" because that is where it winds up at? Then I have to use
Outlook and connect to the pop3 server at that location to get the mail.

Here's my situation. I just bought a domain name and got it registered. I am hosting that domain
myself on my home PC. OK so far. When I use IE on another PC and type in www.my_new_domain.com
I get connected to my HTTP server running on my other PC. This I understand.

But now, I want to also have a Mail server so that when you send mail to bob@my_new_domain.com I
want the mail to wind up at my home mail server. So far, that doesn't work. Am I getting into something
that is beyond hope?   

I'm out of time for this one.  Will come back answer later, unless someone else chooses to help with this one.

Regards,  P1  :8)
Title: Re: EMAIL
Post by: tenkey on August 12, 2005, 03:05:58 AM
Quote from: Robert Collins on August 11, 2005, 09:31:50 PM
If I send mail to someone Outlook sends that mail to my IPS' mail server (SMTP Server listening on port 25).  I know this because I just set up a quickie program listening on port 25 and it got the connection from Outlook. All I had to do was go into Outlook and change the address of the outgoing mail (SMTP) to point to my home made application. This tells me that I can point to any address and so long as there is a program at that address listening on port 25 it will get the mail for Outlook.
Quote from: P1Thought some clients act like an server and SMTP mail directly to the destination server.

That was my impression of how SMTP is used. Why do I need to specify SMTP server names with every e-mail program I use? Because, apparently, my ISPs want me to talk to their SMTP server.

Regardless of the way e-mail is sent...

The (first) e-mail server that will store away your e-mail needs to be an SMTP server. You also need to set up some special DNS records to let other servers know what e-mail servers are available in your domain. Once the e-mail is stored, e-mail "readers" can access the e-mail with any available protocol, POP3 or otherwise.
Title: Re: EMAIL
Post by: Tedd on August 12, 2005, 02:30:56 PM
Maybe you should do a bit of reading :P

POP3 - http://www.ietf.org/rfc/rfc1939.txt
SMTP - http://www.ietf.org/rfc/rfc2821.txt
Title: Re: EMAIL
Post by: P1 on August 12, 2005, 02:42:50 PM
Thank You Tedd!!

Regards,  P1  :8)
Title: Re: EMAIL
Post by: P1 on August 12, 2005, 02:55:37 PM
Let take an example of a bad SMTP server address in a e-mail from Outlook.

Send an e-mail to NOSPAM@NOSPAM.COM

Outlook will take it and send it via POP3 to the local server.  And you will not get any errors from Outlook.

When the local server tries to forward it via SMTP, it will find the error and write you a nice e-mail back saying to the effect, that e-mail server does not exist, the next time you get mail.

More later.

Regards,  P1  :8)

Title: Re: EMAIL
Post by: tenkey on August 13, 2005, 04:19:25 AM
Hmmm. That POP3 RFC link doesn't show a protocol for sending e-mail from a client, only receiving from the server. The document is fairly short, so am I blind?
Title: Re: EMAIL
Post by: Robert Collins on August 13, 2005, 04:50:49 AM
Quote from: P1 on August 12, 2005, 02:55:37 PM
Let take an example of a bad SMTP server address in a e-mail from Outlook.

Send an e-mail to NOSPAM@NOSPAM.COM

Outlook will take it and send it via POP3 to the local server.  And you will not get any errors from Outlook.

When the local server tries to forward it via SMTP, it will find the error and write you a nice e-mail back saying to the effect, that e-mail server does not exist, the next time you get mail.

More later. 

Regards,  P1  :8)

Again, I ask what is this local server? You say that Outlook will send it to the local server. I see no local server on my PC. I see only Outlook which is a client. From my testing, I saw that Outlook sends email to "smtp.email.msn.com" but that server is not on my machine, it is on the Microsoft domain.
Title: Re: EMAIL
Post by: Tedd on August 15, 2005, 12:09:07 PM
Quote from: tenkey on August 13, 2005, 04:19:25 AM
Hmmm. That POP3 RFC link doesn't show a protocol for sending e-mail from a client, only receiving from the server. The document is fairly short, so am I blind?

Blind? Nope, not quite :wink
POP3 is ONLY for receiving emails (by the client, from the server), not sending.
SMPT is for sending (and not receiving).
Title: Re: EMAIL
Post by: P1 on August 15, 2005, 02:46:07 PM
Robert,

I own you an apology!  You are right that a "Internet Account" setup on Outlook and other clients, do use a Local SMTP server to relay out the message from the client. 

I was wrong and you right.  I apologize for confusing you over the e-mail flow in this transaction type. 

But the POP3 local server is configured ( or should be ) to be the local STMP gateway/relay for the POP3 client.

But the previous example is correct in that the Local server is the device that forwards the e-mail to all recipients of the message.  The client only delivers the message to the relay server, not the the destination clients.

I will be doing some testing tonight to verify the above.

In my early POP3 account days, I had used the same server for the inbound and outbound mail flow.  And in all the other E-mail servers since then as well.  But it was Groupwise & Exchange since then.

Regards,  P1  :8)

Title: Re: EMAIL
Post by: Tedd on August 15, 2005, 05:42:29 PM
A brief explanation of how it (generally) works..

I want to send an email from myself@my.email.com to myfriend@some.other.email.com

So first I write my email and then use SMTP on port 25 to give the email to the smtp server at my.email.com

Upon receiving this email, the mailhost for my.email.com will recognize that the destination is not local, and so will forward the email on to (possibly indirectly through several other servers) eventually reach some.other.email.com

At some.other.email.com, the mailhost will recognize that the destination is a local account, and so hold on to the email :wink

Then, myfriend wants to read their email, so they log in to their account on some.other.email.com and use POP3  on port 110 to ask the server if there is any email for the myfriend account. And there is! So the email is received and read and so on..


(Equally, if myfriend should reply, they would send with smtp, and I would receive that reply with pop3)
Title: Re: EMAIL
Post by: AeroASM on September 12, 2005, 01:23:58 PM
Quote from: Robert Collins on August 13, 2005, 04:50:49 AM
Again, I ask what is this local server? You say that Outlook will send it to the local server. I see no local server on my PC. I see only Outlook which is a client. From my testing, I saw that Outlook sends email to "smtp.email.msn.com" but that server is not on my machine, it is on the Microsoft domain.

When they say "local", they do not mean on your machine but the one in your vicinity (fairly loose definition of vicinity though). They mean local as in your ISP's email server, as opposed to some other email server.

A normal mail server has two sockets:

One socket to listen on port 110 protocol SMTP to wait for any messages, whether they come from a PC or another server, and relay them on to another SMTP server.

Another socket to listen on port 25 protocol POP3 to wait for a connection from a PC, to request new mail to be downloaded.

A mail client has one socket, to do two things:

One socket to connect to the SMTP server to send mail
Another socket to connect to the POP3 server to receive mail.

However what you want to do is set up an alias or mail forwarding service, such that any mail addressed to your domain name goes to your home email address. in this case you don't need a pop3 server, because your domain name server will have no clients. You need an SMTP server which just relays on messages from other servers, with one exception. When an SMTP receives a message which belongs to one of its clients it will store it in a server-side mailbox to be collected later on by the client (using POP3). When your server receives a message which belongs to one of its own clients, it needs to re-address it to your home email, then send it on.

(please can someone check this, because I have no prior knowledge and have pieced this together from the earlier posts in this thread)
Title: Re: EMAIL
Post by: Tedd on September 13, 2005, 11:53:23 AM
Quote from: AeroASM on September 12, 2005, 01:23:58 PM
One socket to listen on port 110 protocol SMTP to wait for any messages, whether they come from a PC or another server, and relay them on to another SMTP server.

Another socket to listen on port 25 protocol POP3 to wait for a connection from a PC, to request new mail to be downloaded.

pedanticism:
smtp = port 25
pop3 = port 100

Otherwise it sounds correct.
Title: Re: EMAIL
Post by: AeroASM on September 13, 2005, 03:24:18 PM
Quote from: Tedd on September 13, 2005, 11:53:23 AM
Quote from: AeroASM on September 12, 2005, 01:23:58 PM
One socket to listen on port 110 protocol SMTP to wait for any messages, whether they come from a PC or another server, and relay them on to another SMTP server.

Another socket to listen on port 25 protocol POP3 to wait for a connection from a PC, to request new mail to be downloaded.

pedanticism:
smtp = port 25
pop3 = port 100

Otherwise it sounds correct.


actually its pedantry, to be pedantic ;)  :U
Title: Re: EMAIL
Post by: Tedd on September 14, 2005, 10:21:10 AM
Quote from: AeroASM on September 13, 2005, 03:24:18 PM
actually its pedantry, to be pedantic ;)  :U

Actually, it's "smartass" :lol