If you are familiar with US postal service, perhaps this analogy helps
1. You give message to mailman
2. mailman drives it to local postal center
3. postal center transports it to remote postal center
4. mailman picks up message from remote postal center
5. mailman delivers it to recipient
So we have two types of connections here: public to postal service (#1, #5) and then
postal service to postal service (all others).
What happened with Internet mail though is that anybody could have sent messages claiming to be from one postal center to another, there was no checks to make sure a message actually originated at a customer > mailman connection, etc. Port 25 is postal service connections, Port 587 is designated for customer > postal service connections, so to speak. Analogy is not perfect, step #5 is done with POP3/IMAP and might not be a #4, not sure as I don't run mail servers myself.
Perl / MySQL / HTML+CSS