How does a mail server work?

daluu used Ask the Experts™
I've worked with web servers but never with a mail server. I would like to know how it works with the internet infrastructure. I have some ideas and questions and would like to get the "big" picture.

the mail server can use the same IP as the web server right? only it uses different ports. POP3 and IMAP inboxes are mail server user accounts right? using a mail server to send emails (via applications) only doesn't require any user accounts other than admin and system accounts right?

Big questions:
How are email addresses "" mapped to the mail server accounts? I've got domain and web hosting from providers recently setup to work together, and I figure the domain registrar DNS forwards your domain emails to the mail server. the mail server looks at the first part or "username" of the email address of the email received and determines which user's inbox on the server to send to. if none, send to some default inbox. so then do you specify a domain name for the mail server configuration also to append a domain name to the user account for outgoing mail sent via the user accounts? and if domains are mappings for IP addresses then, are such emails as you@ usable? (although awkward)

so does this mean the DNS server sends domain emails to the mail server and mail server routes emails accordingly to user accounts and thus doesn't deal with domain stuff in the email addresses other than what was set in the server configuration for mail server domain to use?

Does that mean mail servers don't really work without a DNS server for POP3 and IMAP but is ok if using SMTP only? Or can you send email to server by means of user@server_IP for POP3 and IMAP?

I want a complete, concise reply on this that answers all questions. thanx for your help.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
1) Yes, the mail server can sit on the same physical server and use the same IP address and the web server. You are correct, the ports are mapped to the application, so your web server would listen on ports 80 and 443, while your mail server would listed on ports 25, 110, etc.

2) If you want to have an application send emails, it depends on what type of connection it uses. Some applicatios use MAPI, which would require a mailbox and logon. If your application simply uses SMTP, the mail server just needs to be configured to relay mail from your application.

3) Email addresses are mapped to the mail servers by MX records. An MX record is an entry in your DNS server which specifies the IP address of your mail server. The mail server knows what domain it is responsible for, so when it receives a message it looks at the domain portion and if it matches the local domain, the server attempts to deliver it. If a recipient on the server has an address associated with it which matches the message, it is delivered.

4) You cannot use IP addresses in an email address.

5) The DNS server never sees the message. DNS is like a phonebook. The sending server looks up the IP address for the mail server for the destination domain, then sends the message to that IP.

6) The mail server always looks at the domain portition to determine if the message is destined for the local server, or if it should be routed to another server.

7) Mail servers cannot deliver email to other mail servers without DNS.

i agree with jjmck except for point 4. I have used ip address while i waited for my dns to go online.
You can be you@YOUR_IP as long as you put in an entry on your mailserver to go ahead and accept *@YOUR_IP i know this option can be configure on MDAEMON as an alias.
Good Luck
I just tried this and it worked - I stand corrected!
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

hey jjmck
what mailserver are you using?
Exchange 2000


thanx for the comments. I've decided to award you both.

Tversi, your comment on using IPs is one of the major points of my question and is really helpful. Your points are at

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial