SMTP and ncat

HEIG-VD DAI - SMTP and ncat

Link to the course

L. Delafontaine and H. Louis, with the help of GitHub Copilot.

Based on the original course by O. Liechti and J. Ehrensberger.

This work is licensed under the CC BY-SA 4.0 license.

SMTP and ncat

Objectives

  • Learn electronic messaging protocols:
    • SMTP
    • POP3
    • IMAP
  • Focus on the SMTP protocol
  • Learn how to use ncat and Java to send an email to an SMTP server
SMTP and ncat

Electronic messaging protocols: SMTP, POP3 and IMAP

More details for this section in the course material. You can find other resources and alternatives as well.

SMTP and ncat

Electronic messaging protocols: SMTP, POP3 and IMAP

  • Email clients are called Mail User Agents (MUA)
  • Email servers are called Mail Transfer Agents (MTA)
  • They use different protocols to communicate
SMTP and ncat

SMTP

  • SMTP: Simple Mail Transfer Protocol
  • Uses TCP port 25 (unencrypted) or 465 (encrypted)
  • Used to send emails
SMTP and ncat

POP3

  • POP3: Post Office Protocol
  • Uses TCP port 110 (unencrypted) or 995 (encrypted)
  • Used to retrieve emails from a server
SMTP and ncat

IMAP

  • IMAP: Internet Message Access Protocol
  • Uses TCP port 143 (unencrypted) or 993 (encrypted)
  • Used to retrieve emails from a server
  • Much more powerful than POP3 (synchronization, ...)
SMTP and ncat

More details for this section in the course material. You can find other resources and alternatives as well.

SMTP and ncat
  • MX: Mail eXchange - Specifies the mail server responsible for a domain name
  • TXT: Store any text-based information. Used for SPF records, for email authentication
SMTP and ncat

Security concerns and spam

More details for this section in the course material. You can find other resources and alternatives as well.

SMTP and ncat

Security concerns and spam

  • SMTP is old and insecure
  • Easy to spoof and forge emails
  • Hard to maintain
  • ➡️ Your email server can be used for spam and can be blocked
  • ➡️ We will use a mock server to simulate an email server
SMTP and ncat

A focus on the SMTP protocol

More details for this section in the course material. You can find other resources and alternatives as well.

SMTP and ncat

A focus on the SMTP protocol

  • SMTP is a text-based protocol
  • Messages are sent by the client to the server
  • The server responds with a status code
  • The client can send the next command
SMTP and ncat
  • HELO /EHLO
  • MAIL FROM
  • RCPT TO
  • DATA
    • Subject:
    • From:
    • To:
    • End by .
  • QUIT
SMTP and ncat

ncat

More details for this section in the course material. You can find other resources and alternatives as well.

SMTP and ncat

ncat

  • ncat is network utility for reading from and writing to network connections
  • It is used to connect to a remote server (SMTP, HTTP, ...)
  • We will use it to interact with a SMTP server
SMTP and ncat

Questions

Do you have any questions?

SMTP and ncat

Practical content

SMTP and ncat

What will you do?

  • Install and configure ncat
  • Start a SMTP server with Docker Compose
  • Send an email with ncat to the SMTP server
  • Send an email with Java to the SMTP server
SMTP and ncat

Now it's your turn!

  • Read the course material.
  • Do the practical content.
  • Ask questions if you have any.

➡️ Find the course on GitHub.

Do not hesitate to help each other! There's no need to rush!

SMTP and ncat

Finished? Was it easy? Was it hard?

Can you let us know what was easy and what was difficult for you during this chapter?

This will help us to improve the course and adapt the content to your needs. If we notice some difficulties, we will come back to you to help you.

➡️ GitHub Discussions

You can use reactions to express your opinion on a comment!

SMTP and ncat

What will you do next?

We are arriving at the end of the second part of the course.

An evaluation will be done to check your understanding of all the content seen in this second part.

More details will be given in the next chapter.

SMTP and ncat

Sources