Understanding the theory behind mail servers, web servers

0

I pretty much understand the theory behind web servers, which is basically: There's someone's webserver waiting for our request for which it responds.

But I find a bit of ambiguity when people say your mail server. I was reading a text on networking which constantly uses this, saying my mail server. But doings some coding my friend asked me, which mail server are you going to use? Is it google's mail server?

So, my basic point of confusion is, where do we send our mail to, I know it's gonna go to a mail server; But:

  1. Is there going to be my mail server: Like is there a local mail server like a local DNS server? First my local mail server gets it and it gives to google's mail server and so on.
  2. Are mail servers held at ISPs?

  3. Are mail servers different from web servers, i.e. are they different machines or are they two processes running on the same machine?

  4. I also hear SMTP servers, are they same as mail servers, just a
    different terminology or something else?

mathmaniage

Posted 2018-04-12T06:49:30.957

Reputation: 233

Answers

3

They are essentially the same as web servers, in that they can be hosted anywhere that your computer is able to connect to.

You can have a locally hosted mail server that is on the public internet and can be passed mails (via SMTP) which your mail client can then retrieve (via POP3 or IMAP). Or you can have a mail server which is not publicly accessible but simply retrieves mails from one which is.

Typically though a home user has neither of those, they simply have a mail client which is set up with the address details of their incoming and outgoing mail servers, be it Google or Outlook or SomeOtherMailService.

To answer your questions:

  1. Is there going to be my mail server: Like is there a local mail server like a local DNS server? First my local mail server gets it and it gives to google's mail server and so on.

You can, but probably don't. See above.

  1. Are mail servers held at ISPs?

If you go with the ISP provided email service then yes.

If they offer the service but you don't use it then they still have servers but you simply bypass them and go direct to your actual mail service.

If they don't offer the service then no, they don't need or have mail servers.

  1. Are mail servers different from web servers, i.e. are they different machines or are they two processes running on the same machine?

They are typically just programs running on a machine. It can be the same machine as a web server or a separate machine. How it is set up is up to the people who set it up.

  1. I also hear SMTP servers, are they same as mail servers, just a different terminology or something else?

SMTP is the protocol used to transfer mails from a client to a server or for a server to pass it on to another server. An SMTP server is a server specifically waiting to relay mail messages onwards to a final destination.

Think of SMTP as the post box in the street and the postal system behind it. SMTP manages the routing and delivery of mail just like the postal system does.

You then collect your mail from a "holding" mail server rather than a relay mail server. You can thing of this as your doormat if that helps with the analogy, but it is simply another server you connect to to check for mails.

Mokubai

Posted 2018-04-12T06:49:30.957

Reputation: 64 434

are outgoing and incoming mail servers different? Aren't they just one machine? – mathmaniage – 2018-04-12T08:09:32.083

and if mail and web servers have can be two processes running on the same machine, how can they have two different cannonical names for the same machine? – mathmaniage – 2018-04-12T08:10:54.893

@mathmaniage Outgoing and incoming mail servers can be two separate programs running on one machine, two programs running on two machines, or one program on one machine that responds on two different ports. It's entirely dependant on software used and how the IT department set it up. Machine names are just that, names. Just like you can have several different names on the internet machines can also have multiple names for the same server, that is one of the things that DNS can do for you. – Mokubai – 2018-04-12T08:15:56.940

I found out google is now using an internal api for sending mail and all. Does that mean we'd be unable to send mails using smtp only? – mathmaniage – 2018-04-12T08:35:54.850

No, because their API is only used internally, presumably for Google mailboxes to other Google mailboxes, for their Webapp and Android/iOS apps, or to simply transit their rather voluminous and convoluted network topology. The external "standard" interfaces will still be SMTP. – Mokubai – 2018-04-12T08:45:28.603

Well, please see this: https://stackoverflow.com/questions/10147455/how-to-send-an-email-with-gmail-as-provider-using-python , IDK in the question section in the comments it's written a bit different.

– mathmaniage – 2018-04-12T08:53:49.467

also using the smtplib for gmail doesn't work: https://pastebin.com/LnbUrgzQ

– mathmaniage – 2018-04-12T08:59:16.113

it says to login via a web browser – mathmaniage – 2018-04-12T09:00:56.403

Maybe I should make another post for this one. – mathmaniage – 2018-04-12T09:03:02.540

Ah. Okay. Google are effectively phasing out SMTP in favour of a different and more secure standard. That doesn't really change the crux of the question or my answer but really should be a different question entirely. It's a different method of moving messages, but the result is the same: you pass your emails to Google, they move them on for you. – Mokubai – 2018-04-12T09:15:29.893

It’s still SMTP, but with OAuth 2.0 authentication. – Daniel B – 2018-04-12T10:15:55.297

@DanielB , Don't know about the techies but that doesn't mean we can use something like: https://coad.ca/2017/05/17/sending-emails-using-tls-gmail-and-python/ right?

– mathmaniage – 2018-04-13T12:12:21.743

You can, but you wouldn’t use a password to log in but XOAUTH2. The topic of how to use it is more suitable for [so].

– Daniel B – 2018-04-13T13:09:33.050

1

In addition to @mokubai answer -

Details of how to locate the mail server for your domain are stored in the DNS system using a specific record type (an MX record) - indeed it can have more then1 for reliability. These records are treated differently to the A, AAAA and CNAME records used for web servers.

A mail server is a bit of a misnomer - mail servers consist of a number of elements - which can be spread over a number of machines. The typical ones are an SMTP server - which sends and received email between mail servers and often - but sometimes on a separate machine and with different parameters- accepts emails from end users. It also typically supports one or more mechanisms for users to retrieve emails - often POP or IMAP - which again can be separate servers - and typically spam filters - often sitting between the pop/imap servers and dmtp servers.

This can, of course, all be done on 1 machine as well.

davidgo

Posted 2018-04-12T06:49:30.957

Reputation: 49 152