In this project, I designed and implemented a simple mail server and client using the SMTP and POP3 protocols. The SMTP protocol is used for sending emails between user and server or server and server, while the POP3 protocol is used for retrieving emails from a mail server.
- Implement an SMTP server program referring RFC 5321: To send and receive emails using the SMTP protocol.
- Implement a POP3 server program referring RFC 1939: To retrieve and manage emails using the POP3 protocol.
- Handle multiple users and concurrent connections: The server should handle multiple users accessing their mailboxes simultaneously.
- Implement a client program: The client program can connect to SMTP server and send mails, can connect to POP3 server to retrieve inbox mails
- SMTP Server (smtpmail.c): Receives and stores emails.
- POP3 Server (popserver.c): Allows clients to access and manage their mailboxes.
- Mail Client (mailclient.c): Implements both sending and receiving of emails.
-
Create User Directory and File:
- In the directory where the programs will run, create a file named
user.txt
. Each line should contain a username and password separated by spaces. - Create a subdirectory for each user specified in
user.txt
.
- In the directory where the programs will run, create a file named
-
SMTP Server (smtpmail.c):
- Takes a command-line argument
my_port
to specify the port number. - Listens on
my_port
for incoming connections. - Receives emails and stores them in the respective user's subdirectory in a file named
mymailbox
.
- Takes a command-line argument
-
POP3 Server (popserver.c):
- Takes a command-line argument
pop3_port
to specify the port number. - Handles client connections, allowing users to access and manage their mailboxes.
- Takes a command-line argument
-
Command-line Arguments:
server_IP
: IP address of the MailServer machine.smtp_port
: Port number of the SMTP server.pop3_port
: Port number of the POP3 server.
-
User Options:
- Manage Mail: View stored emails.
- Send Mail: Compose and send an email.
- Quit: Exit the program.
From: @<domain_name>
To: @<domain_name>
Subject: <subject string, max 50 characters>
<Message body, terminated by a line with only a fullstop>
From: @<domain_name>
To: @<domain_name>
Subject: <subject string, max 100 characters>
Received: time in date hour minute
<Message body, same as recieved to the server>
- HELO
- RCPT
- DATA
- QUIT
- 220
<domain name>
Service Ready - 221
<domain name>
Service closing transmission channel - 250 OK
<message>
- 354 Start mail input; end with
<CRLF>.<CRLF>
- 550 No such user
- STAT
- LIST
- RETR
- DELE
- RSET
- QUIT