Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP30023
Email client
Weight: 15% of the final mark
1 Project Overview
The aim of this project is to familiarize you with socket programming. Your task is to write a simple email client
that downloads and parses email from a standards-compliant IMAP server.
Writing network code relies on conformance to standards, and so part of this project is to look up the relevant
standards (Requests for Comments, RFCs). You may also refer to online tutorials; if you do, then please mention
them in the comments of your code.
Your email client must be written in C or, if you get prior permission, in Rust. Submissions that do not compile
and run on a cloud VM may receive zero marks.
Blue text in this document is hyperlinked to resource material.
2 Project Details
Your task is to design and code a simple email client.
2.1 Program execution / command line arguments
The program should be be launched using the command:
fetchmail
-u -p [-f ] [-n ] [-t]
Where may be one of: retrieve, parse, mime, or list.
The options beginning with “-” can occur in any order, including between and/or after the 2 positional arguments.
The arguments in square brackets are optional.
All assessed output must be printed to stdout.
If you want to output debugging information, use stderr.
2.2 Logging on
Version 4rev1 of the IMAP protocol is specified in RFC 3501 and the below just describes one possible way that
it can be used to implement this project.
The basic steps to retrieving an email are:
• Create an IPv6 socket (or fall back to IPv4 if IPv6 is not supported) on port 143 (or a TLS socket on port
993 if you are doing the extension task and -t was specified) to the host named on the command line.
• Log in to the IMAP server using:
1
tag LOGIN username password
where username and password are as specified on the command line.
Each command is prefixed with an identifier, or tag (such as A01). The tags should all be different within
one session. These are used for the server to report errors or completion of commands.
Each line ends with the standard internet end-of-line sequence \r\n (not the standard C end-of-line).
If this succeeds, you will receive a string starting with the tag, followed by a single space, (a case-insensitive)
OK, and another single space. For more details, refer to the response, response-done, and response
-tagged rules of the formal syntax.
If it fails, you should print the string Login failure\n to stdout and exit with status 3.