JavaFX Secure Email Client
Overview
This is a fully functional, GUI-based email client developed using Java, JavaFX, and the JavaMail API. It allows users to configure multiple email hosts (Gmail, Outlook, etc.) to send and receive emails with attachments securely.
Unlike simple scripts, this project is built on a robust Model-View-Controller (MVC) architecture, featuring multithreading for responsiveness and strict exception handling for network reliability.
🛡️ Cybersecurity & Network Security Features
As a project with a focus on security, I prioritized secure communication channels and robust data handling. Key security features include:
End-to-End Encryption:
Enforces SSL/TLS encryption for all SMTP (Sending) and IMAP (Receiving) connections.
Utilizes javax.net.ssl.SSLSocketFactory to prevent Man-in-the-Middle (MitM) attacks during the handshake.
Strictly enforces secure ports: 465 (SMTPS) and 993 (IMAPS).
Secure Authentication:
Designed to work with App Passwords (API Keys) rather than raw account passwords, adhering to modern Least Privilege principles.
Implements a "Verify Before Save" protocol: Credentials are tested against the server via a secure channel before being committed to storage.
Input Sanitization & Validation:
All user inputs (ports, hosts, body text) are validated at the controller level to prevent injection errors or application crashes.
Port numbers are strictly type-checked to prevent buffer issues or malformed packet generation.
🚀 Key Functionality
Multi-Host Management: Save and switch between different email accounts dynamically.
Smart Folder Detection: Automatically detects "Sent" folders, handling localization variations (e.g., supports [Gmail]/Sent Mail, [Gmail]/Gönderilmiş Postalar, and standard Sent Items).
Attachments: Full support for sending files and detecting received attachments.
Threading: All network operations (Fetch, Send, Login) run on background threads to ensure the UI remains responsive, preventing Denial of Service (DoS) behaviors on the main thread.
Persistence: Uses Java Serialization to locally cache host configurations.
🏗️ Architecture (MVC)
The project is structured to ensure modularity and clean code separation:
Model: (EmailAccount, EmailMessage) Defines data structures for credentials and content.
View: (EmailClientView.fxml) A separation of concerns using FXML for the GUI layout.
Controller: (EmailClientController) Handles business logic, event listeners, and bridges the View and Service layers.
Service: (EmailService) Encapsulates the JavaMail API network logic, handling socket connections and protocol negotiation.
🛠️ Tech Stack
Language: Java 17+
GUI Framework: JavaFX (FXML)
Network Library: JavaMail API (Jakarta Mail)
Build Tool: Ant / NetBeans Default
Protocol Support: IMAP, SMTP, POP3 (with SSL/TLS)