Skip to main content

What is SMTP?

SMTP (Simple Mail Transfer Protocol) is an application-layer protocol used to send email.

In short: SMTP is responsible for sending messages from the sender to a mail server and between servers.


Why SMTP is needed

SMTP is needed so that:

  • a mail client can send a message
  • mail servers can pass a message to each other
  • the message reaches the recipient's server

Important: SMTP is only about sending, not about reading messages.


How SMTP works (simplified)

The process looks like this:

  1. The user clicks "Send message"
  2. The mail client sends the message via SMTP to its own mail server
  3. The sender's mail server finds the recipient's server
  4. The servers pass the message to each other via SMTP
  5. The message arrives at the recipient's server

After that, the recipient retrieves the message using a different protocol.


SMTP and receiving mail

This is a common point of confusion in interviews.

  • SMTP - sending messages
  • POP3 / IMAP - receiving messages

You cannot receive a message via SMTP - only send one.


What data SMTP transfers

SMTP transfers:

  • the sender's address
  • the recipient's address
  • the subject line
  • the message body
  • attachments (in a special format)

For SMTP, a message is a text message with formatting rules.


SMTP security

In its classic form, SMTP:

  • does not encrypt data
  • transfers logins and messages as plain text

So in practice people use:

  • SMTP + TLS (STARTTLS)
  • protected ports

A real-life example

SMTP is like a postal service:

  • you put a letter in the mailbox
  • the post delivers it to the right branch
  • then the recipient picks up the letter themselves

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.