Coding Phase - Week 4 Report

Goals Achieved

  • Installed IMAP and its requirements and made the first IMAP connection in the plugin (SSL/TLS) (I will add another security layer command, STARTTLS, but only after reading about it well and testing it enough.).
  • Added the manual connection screen.
  • I read about RFC 822, the message email format, and the message parser behavior.
  • I have done a stress test for more than one email provider, which is to monitor the mailbox every 5 seconds if there is a new message from a specific email to check that there is no security problem that could have arisen.

Next week

  • Creating an error alarm, a warning alarm when an error is caused while logging
  • Create the Main Screen
  • Fetching & monitoring based on 'from'.
  • During this week, I will post in the forum an addition that I would like to get your opinion on :grinning:, and it is related to the conversion of emails, including attachments, to notes without logging into a plugin and without any external programs and Is it worth adding this feature or not :thinking:

Demo:

6 Likes

could you summarize it?

yes sure

The RFC 822 specification defines an electronic message format, and this format is what I will receive from IMAP. It contains everything related to the message: headers (from, to, cc, etc.), text, images, media, and attachments.

This format deals with embedded images or attachments by the cid (content-id). Each image or attachment has a unique cid and this contains everything related to the image or attachment, from type, size, and the type of encoding of that attachment, like Base64.

Each content is separated from the other by a boundary that is specified at the beginning of the message.

example:

------------ An example of the header content: -----------------------

Delivered-To: bishoy.magdy.adeeb@gmail.com
Received: by 2002:a05:7110:70c2:b0:188:87bb:ab55 with SMTP id k5csp2160218geh;
Date: Sun, 3 Jul 2022 17:03:42 +0300 (MSK)
From: Codeforces@codeforces.com
To: bishoy98magdy@gmail.com
Message-ID: <1151498597.262915.1656857022443.JavaMail.Codeforces@codeforces.com>
Subject: Codeforces Round 804 (Div. 2)

------------ An example of the message content: -----------------------

[cid:colors-top]
Hi bishoy,
        Welcome to your new account. Outlook lets you stay conn=
ected, organized, and productive=97at work, at home, and everywhere in betw
een.
[cid:devices.png]
Discover a more productive inbox across all your devices
Managing your busy life shouldn't be difficult. With email and calendar in =
just one service, Outlook makes it easy for you to stay on top of it all =
=97 whether you're catching up on conversations, setting up coffee dates, o=
r organizing a weekend trip.
[cid:colors]

-------------------Boundary-------------------------
Content-Type: multipart/related;
boundary="_013_AM9P193MB16520D9165C9144487C176BC8BBA9AM9P193MB1652EURP_";
	type="multipart/alternative"
	
.
..
...
....
------------- An example of the cid content: -------------

--_013_AM9P193MB16520D9165C9144487C176BC8BBA9AM9P193MB1652EURP_
Content-Type: image/png; name="colors.png"
Content-Description: colors.png
Content-Disposition: inline; filename="colors.png"; size=5306;
	creation-date="Sun, 12 Jun 2022 17:21:36 GMT";
	modification-date="Thu, 30 Jun 2022 12:44:28 GMT"
Content-ID: <colors>
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAHIAAABrCAYAAACrBNYuAAAAAXNSR0IArs4c6QAAFHRJREFUeAHt
XQtwXNV5PufuXUm2JdtgWxa2JT8SwBgwBoxkYWOLOCaYSUvq1Elp+qCdBhIDSTudNG3aMm4amrQz
JGmaIdRhJnQC06QmnTbphJY4xIDxK8QYY+yMAWNJli2/MJatx2r33tP/v1ef9vf1rrS72l3d3eXM
7P7/+c//ncf/3XPfD63eT6pt4y9s9d682n4zsdqNJ6psFa1OaKc6oky1cSMJSw/22VU1vYOO1Tth

--_013_AM9P193MB16520D9165C9144487C176BC8BBA9AM9P193MB1652EURP_
Content-Type: image/png; name="devices.png"
Content-Description: devices.png
Content-Disposition: inline; filename="devices.png"; size=94183;
	creation-date="Sun, 12 Jun 2022 17:21:36 GMT";
	modification-date="Thu, 30 Jun 2022 12:44:28 GMT"
Content-ID: <devices.png>
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAABwgAAAPUCAMAAACO/p3zAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ
bWFnZVJlYWR5ccllPAAAA4ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdp
bj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbn

--_013_AM9P193MB16520D9165C9144487C176BC8BBA9AM9P193MB1652EURP_
.
..
....
-----------------------HTML formate------------------------
--_013_AM9P193MB16520D9165C9144487C176BC8BBA9AM9P193MB1652EURP_
html content
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit


and so on

It also has other large amounts of information about the message, like ARC-Seal, ARC-Message-Signature, and other complex information.

I will pass this format to the parser and I will get an object containing the HTML, Text, array of attachments, from, to,...

2 Likes

Make sure you add a few simple tests to check you're getting the right data from the parser, since there are often strange edge cases with these old standards.

1 Like