DEV Community

Cover image for Exploring Data Flow via Email Transmission
M. Oly Mahmud
M. Oly Mahmud

Posted on

Exploring Data Flow via Email Transmission

Sending an email may seem simple, but it involves a complex journey through the OSI (Open Systems Interconnection) model. In this article, I will explain how data travels through each OSI model layer when Alice, a user, sends an email to Bob using an email client.

Visual Overview of OSI model

OSI Model

Scenario: Sending an Email

Alice wants to send an email to Bob using her email client.

The travel of data flow

1. Application Layer (Layer 7)

Role: Interacts with the user’s software.

  • Alice types her email message in an email client (e.g., Gmail or Outlook).

  • The email client uses an Application Layer protocol, such as SMTP (Simple Mail Transfer Protocol), to format the email.

  • Data at this stage: Human-readable email text and metadata, such as the recipient’s email address.

2. Presentation Layer (Layer 6)

Role: Data formatting, encryption, and compression.

  • The email client encodes the message in a standard format, such as ASCII or Unicode.

  • If encryption is enabled, the email is encrypted using protocols like SSL/TLS to ensure security.

  • Data at this stage: Encoded and possibly encrypted email data.

3. Session Layer (Layer 5)

Role: Manages communication sessions.

  • A session is established between Alice’s email client and her email server.

  • Protocols like SMTP, IMAP, or POP3 ensure reliable communication.

  • Data at this stage: Session data and control information.

4. Transport Layer (Layer 4)

Role: Ensures reliable delivery of data.

  • The Transport Layer breaks the email message into smaller packets for transmission.

  • TCP (Transmission Control Protocol) ensures that all packets are delivered correctly and in the right order.

  • Data at this stage: Packets with TCP headers containing sequence numbers and error-checking information.

5. Network Layer (Layer 3)

Role: Determines the best route for data.

  • Each packet is assigned a source and destination IP address (e.g., Alice's computer and Bob's email server).

  • Routers use these IP addresses to forward packets to the correct destination.

  • Protocol used: IP (Internet Protocol).

  • Data at this stage: Packets with IP headers containing source and destination addresses.

6. Data Link Layer (Layer 2)

Role: Handles physical addressing and prepares data for the physical network.

  • Packets are framed with MAC (Media Access Control) addresses for the local network (e.g., Alice’s Wi-Fi router).

  • Error detection mechanisms, such as CRC (Cyclic Redundancy Check), are added.

  • Data at this stage: Frames containing MAC addresses and error-checking information.

7. Physical Layer (Layer 1)

Role: Transmits raw bits over the physical medium.

  • The email data is converted into electrical signals, light pulses, or radio waves, depending on the transmission medium (e.g., Ethernet cable, fiber optic cable, or Wi-Fi).

  • These raw bits travel through the network to Bob’s email server.

  • Data at this stage: Raw binary bits (0s and 1s).

Reception at Bob’s End - The Reverse Journey

The process is very simple. It's just the reverse process of Alice. This process is done at Bob’s email server.

Physical Layer: Bits are received and converted back into frames.

Data Link Layer: Frames are checked for errors and passed up.

Network Layer: IP addresses are used to verify the destination.

Transport Layer: Packets are reassembled into the complete email message.

Session Layer: The session is established for Bob’s email client to retrieve the message.

Presentation Layer: Data is decrypted (if encrypted) and formatted for display.

Application Layer: The email client displays the email to Bob.

Conclusion

The OSI model ensures data gets from point A to point B smoothly. It adds and removes layers of information like wrapping and unwrapping a gift, making sure Alice’s email makes it to Bob securely and in one piece.

Top comments (0)