Jmail Server v1.0

Jmail is a simple socket-based mail server that allows clients to send and receive messages between users. The server handles multiple client connections and stores the messages persistently using JSON files.

Features

File Structure

How It Works

  1. Server Setup:
  2. The server opens a socket and listens for incoming connections on a specified port.
  3. It supports up to 100 simultaneous connections using threading.

  4. Client Connection:

  5. Once connected, the client sends its version number for compatibility checks.
  6. If the client version is compatible with the server, it proceeds to the login process.

  7. Login Process:

  8. Clients must provide a username and password, which are verified against the userdat.txt file.
  9. If the credentials are incorrect or the user does not exist, the client receives a login failure message.
  10. On successful login, the user can access their mailbox and send messages.

  11. Messaging:

  12. Users can refresh their inbox to view new messages.
  13. They can send a message to another user by typing the recipient's username and the message. Messages are stored in jmail.txt.

  14. Error Handling:

  15. The server can handle crashes and displays an error message when it fails.

How to Use

  1. Running the Server:
  2. Ensure Python 3.x is installed.
  3. Run the server using the following command: bash python jmail_server.py
  4. You will be prompted to enter a custom port number (e.g., 90).

  5. Connecting a Client:

  6. The client sends its version number and logs in using their username and password.
  7. Once authenticated, they can send and receive messages.

  8. Sending a Message:

  9. To send a message, the user should input the recipient’s username followed by the message in the following format: plaintext (username) message
  10. The server will store the message and send it to the recipient when they refresh their inbox.

Images