# EMAIL Forensics

* **SPF :** Sender Policy Framework&#x20;
* **DKIM :** Domain keys identified mail&#x20;
* **DMARC :** Domain based Message Authentication Reporting and Conformance

> Conformance is how well something, such as a product, service or a system, meets a specified standard

## Important Terminologies :&#x20;

* MUA : Mail User Agent (Client application)
* MTA : Mail Transfer Agent (mail-server)
* MDA : Mail Delivery Agent (The inbox and the receiving side of the email)
* SMTP Server : The server which is used to send the emails&#x20;
  * The sender side SMTP checks for the receiving side SMTP&#x20;
  * SMTP works on port 25
* POP3(Post Office Protocol) , This automatically download the mails into the receivers hard-disk from the mail server&#x20;
  * POP3 works on port 110
* IMAP (Internet message accessing protocol)&#x20;
  * Used to access the mail&#x20;
  * IMAP works on port 143 and port 993 (over SSL)&#x20;
  * IMAP is responsible for the accessibility of the mails across the devices.

***

<figure><img src="https://2332860236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq6mjlFfyDOi3mV0lemKE%2Fuploads%2Fy55RrbKVfjM9LeRB0ddn%2Fimage.png?alt=media&#x26;token=a46254aa-5667-4b6a-a41b-86b09eb95998" alt=""><figcaption></figcaption></figure>

**Sample Email**

***

{% code overflow="wrap" %}

```
Delivered-To: xxxxxxxxxxxxxxxxx@gmail.com
Received: by 2002:a05:6a10:5ce:b0:3b2:908f:fc5b with SMTP id p14csp158167pxt;
        Thu, 19 Jan 2023 00:49:07 -0800 (PST)
X-Google-Smtp-Source: AMrXdXttqIob61vhMjVEzXZT1tST2g+jnjLCo4vt8h37GHWeRjnceLEwYarvAaQT1HDvVfBnZvIt
X-Received: by 2002:a17:90a:3f8b:b0:229:32be:5027 with SMTP id m11-20020a17090a3f8b00b0022932be5027mr10205377pjc.18.1674118147311;
        Thu, 19 Jan 2023 00:49:07 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1674118147; cv=none;
        d=google.com; s=arc-20160816;
        b=EwddRmMU8tNFIDPyPcSef2ydP/WseD+/NSWmyZdeLSgJQ189jLgSTxi3R+or5fAlri
         u7hnS+TofJZeYuHAqjk3LhQdjW6u+eKmwaEEcqf4zqgbKNCwLBt1Z7WXsjbjFiLLuk0G
         XgnNmBX+DY8y2y5A97/stqoiIqkekAoA6oRDtLdbFY6qS5oPS0KkCrJm0zdLGgvBJDKP
         ifisN+6PHdxkANtgFC4DfQBT/aYj5/jV/LsH5/6RcyZmcYU9OwRL5WGks+KWIC821jpJ
         JNkONY6DJG/qaljFTYXwBhuS00UgEtdgGTKatNuXsnhJBQnkP04d8XVguIUmYfvfMpV8
         nD5w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=feedback-id:mime-version:subject:message-id:to:from:date
         :dkim-signature:dkim-signature;
        bh=MIJ7fa4tTIjWGvlyPQrYrnWlYXWYhbVsjhSjiZLgatM=;
        b=LENUz0YwIZR33kzq9VDTk5cyN5ykv/w0eIpjt768nkEfTk1OgvCdnNdlk0EcRX4Yeg
         LWjIwGjBqIFeYG6IL8daSy+yxfWag7OjgBl43LlAawT69gJ+geTrWtzaFTzyEJokHNiM
         ArajMOoAof762BZkt9Xp/oHqsRylvGp16XbKcmiufnFg/liyuXx3teDbCPQ5sExSuZ+M
         FhzU8TSu5RIQjqShoLAUh5O6KJ05aCCgd8GKrelstin577WU1UQy34duM5IH9kHuQVFu
         cp4zsAZNOEnJUH4Jn0x5oCKDCpGvRXBaAJd2QJDwtVYIENNOn9fvWHqn75MglsPS0qj4
         iXJA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@kukufm.com header.s=pyli425i5kfjtqylu3ksnlm54zhw6pbz header.b=4l8mNfeM;
       dkim=pass header.i=@amazonses.com header.s=dvogjbaa3ou3tduyzvyu4rj5tkuzdi4h header.b=EwHYynY8;
       spf=pass (google.com: domain of 01090185c937a7fc-b33f74e0-c857-4b46-b23a-b00a246b0a91-000000@ap-south-1.amazonses.com designates 76.223.180.103 as permitted sender) smtp.mailfrom=01090185c937a7fc-b33f74e0-c857-4b46-b23a-b00a246b0a91-000000@ap-south-1.amazonses.com
Return-Path: <01090185c937a7fc-b33f74e0-c857-4b46-b23a-b00a246b0a91-000000@ap-south-1.amazonses.com>
Received: from c180-103.smtp-out.ap-south-1.amazonses.com (c180-103.smtp-out.ap-south-1.amazonses.com. [76.223.180.103])
        by mx.google.com with ESMTPS id bt14-20020a17090af00e00b00229bf39a1ecsi4502587pjb.76.2023.01.19.00.49.06
        for <vkanjaria99@gmail.com>
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 19 Jan 2023 00:49:07 -0800 (PST)
Received-SPF: pass (google.com: domain of 01090185c937a7fc-b33f74e0-c857-4b46-b23a-b00a246b0a91-000000@ap-south-1.amazonses.com designates 76.223.180.103 as permitted sender) client-ip=76.223.180.103;
Authentication-Results: mx.google.com;
       dkim=pass header.i=@kukufm.com header.s=pyli425i5kfjtqylu3ksnlm54zhw6pbz header.b=4l8mNfeM;
       dkim=pass header.i=@amazonses.com header.s=dvogjbaa3ou3tduyzvyu4rj5tkuzdi4h header.b=EwHYynY8;
       spf=pass (google.com: domain of 01090185c937a7fc-b33f74e0-c857-4b46-b23a-b00a246b0a91-000000@ap-south-1.amazonses.com designates 76.223.180.103 as permitted sender) smtp.mailfrom=01090185c937a7fc-b33f74e0-c857-4b46-b23a-b00a246b0a91-000000@ap-south-1.amazonses.com
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=pyli425i5kfjtqylu3ksnlm54zhw6pbz; d=kukufm.com; t=1674118146; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type; bh=OcX3QpNX3xyJGZZuZ9Bwm2iAIBe0ZDtnxAFS/YJTNuE=; b=4l8mNfeMX18ElNXGIW7qwavDq3zIUPsCzy86hauc+BCySADd3nKtiWztKyITt1sM +hQ82zr+T3i2HBVaezyqtCQXnaPwGtxVfvARB85C3z1X+wHlsyNQ7oqOl8HZ1uNxm4e ej1HSXz3pZd3hba4COwMjcCctGtdOqnoOz4hkca8=
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=dvogjbaa3ou3tduyzvyu4rj5tkuzdi4h; d=amazonses.com; t=1674118146; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type:Feedback-ID; bh=OcX3QpNX3xyJGZZuZ9Bwm2iAIBe0ZDtnxAFS/YJTNuE=; b=EwHYynY8YqWQ/GhFlmnc6Ocgxb37yn40DO/CVkE9v1Abh+bTIrbx3GPNLTIb96Oi 2PiVm0gY4PUaJIE10uGNlp94mKNYQ3qFtRXZgNdU7iYzJiOX8g9yJoa2EUWIIw6O2ly sec8pjNeBhnc/vqJOw+xi+QOaHJIPqyVbuBxxVRk=
Date: Thu, 19 Jan 2023 08:49:06 +0000
From: Kuku FM <premium@kukufm.com>
To: xxxxxxxxxxxxxxxx9@gmail.com
Message-ID: <01090185c937a7fc-b33f74e0-c857-4b46-b23a-b00a246b0a91-000000@ap-south-1.amazonses.com>
Subject: Ready To Meet Taapsee Pannu? Insta Live in 3..2..1
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_Part_516958_1316911195.1674118146035"
X-CleverTap_META: vkanjaria99@gmail.com|1584353664|1674109788|20230119|0|wzrk_default|-52996139|
X-CLEVERTAP_METADATA: { "X-CLEVERTAP_TARGET_ID" : 1674109788, "X-CLEVERTAP_IID" : { "$numberLong" : "52996139" }, "X-CLEVERTAP_IDN" : { "$numberLong" : "52996139" }, "X-CLEVERTAP_PIVOT" : "wzrk_default" }
Feedback-ID: 1.ap-south-1.+gw0gssA1xAY29etckqp1xQFn1bjykPgmPGkMAHXwc4=:AmazonSES
X-SES-Outgoing: 2023.01.19-76.223.180.103

------=_Part_516958_1316911195.1674118146035
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
------=_Part_516958_1316911195.1674118146035--
```

{% endcode %}

***

**Actual Process of Email**

**Step 1: Composing and Sending the Email**

1. **User Composes Email**: You draft an email on your device, whether it's a computer, smartphone, or tablet.
2. **Clicking "Send"**: After composing your email, you click the "Send" button in your email client.

**Step 2: Routing and Protocols**

3. **SMTP (Simple Mail Transfer Protocol)**: Your email client communicates with your outgoing mail server using SMTP. This protocol helps transfer your email to the server.

**Step 3: Outgoing Mail Server**

4. **Authentication**: The outgoing mail server verifies your credentials to ensure you are authorized to send emails from your account.
5. **Message Submission**: The server receives your email and adds it to the queue for delivery.
6. **DNS Lookup**: The server performs a Domain Name System (DNS) lookup to find the recipient's mail server based on the recipient's email address domain (e.g., gmail.com).

**Step 4: Recipient's Mail Server**

7. **MX Record Lookup**: The recipient's mail server is determined through DNS by looking up the Mail Exchange (MX) records of the recipient's domain.

**Step 5: Delivering the Email**

8. **SMTP Communication**: Your outgoing mail server connects to the recipient's mail server using SMTP. The two servers communicate to establish a connection.
9. **Recipient Verification**: The recipient's mail server verifies that the recipient's email address is valid and exists.
10. **Virus and Spam Scanning**: The recipient's mail server may scan the email for viruses, malware, and spam content to ensure the email is safe.
11. **Delivery to Inbox**: If the email passes verification and scanning, it is delivered to the recipient's inbox.

**Step 6: Recipient Retrieves Email**

12. **Email Client Fetches**: The recipient's email client (e.g., Outlook, Gmail) connects to the recipient's mail server using protocols like IMAP or POP3 to fetch the newly received email.

**Step 7: Viewing the Email**

13. **Display in Email Client**: The email is displayed in the recipient's email client, and the recipient can read and interact with the content.

This description illustrates the general journey of an email from sender to recipient. Each step involves various technical components like servers, protocols, authentication, and checks to ensure smooth and secure email delivery. You can create diagrams to represent each step for a more visual understanding.

***

I understand your request now. Here's a simplified step-by-step process with blocks to illustrate what happens to an email after you click "send."

```
  +----------------+    +-----------------+    +---------------------+
  |                |    |                 |    |                     |
  |   Compose      |    |   Outgoing      |    |  Recipient's        |
  |   Email        |    |   Mail Server   |    |  Mail Server        |
  |                |    |                 |    |                     |
  +----------------+    +-----------------+    +---------------------+
         |                     |                     |
         |                     |                     |
         v                     |                     |
  +----------------+            |                     |
  |                |            |                     |
  |    Click       |            |                     |
  |    "Send"      |            |                     |
  |                |            |                     |
  +----------------+            |                     |
         |                     |                     |
         v                     |                     |
  +----------------+            |                     |
  |                |            |                     |
  |     SMTP       |<-----------+                     |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   Authentication,                                 |
  |   Queueing     |                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   DNS Lookup   |                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   SMTP to      |                                  |
  |   Recipient's  |                                  |
  |   Mail Server  |                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   MX Record    |                                  |
  |   Lookup       |                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   Recipient    |                                  |
  |   Verification |                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   Virus and    |                                  |
  |   Spam Scanning|                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   Delivery to  |                                  |
  |   Recipient's  |                                  |
  |   Inbox        |                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   Recipient's  |                                  |
  |   Email Client|                                  |
  |   Fetches      |                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
  +----------------+                                  |
  |                |                                  |
  |   Display in   |                                  |
  |   Email Client|                                  |
  |                |                                  |
  +----------------+                                  |
         |                                            |
         v                                            |
         |                                            |
         |                                            |
         +--------------------------------------------+

```
