.Net | Blazor Server Email Client (IMAP/SMTP)
AbriMail is a minimal, open-source Blazor Server email client built on raw IMAP4rev1 and SMTP protocols over implicit TLS. It demonstrates how to implement both receiving and sending email functionality without relying on third-party libraries.
A simple implementation of a Blazor Server web-based email client.
- The client will use the IMAP4rev1 and SMTP protocols over implicit TLS/SSL to fetch and send emails.
- The solution is structured as three separate .NET projects to enforce a clean separation of concerns.
- At the beggining only the basic email features will be implemented, focusing on clarity and simplicity while acknowledging limitations.
- Developers learning how IMAP and SMTP work under the hood
- Teams needing a simple web-based email client prototype
- Anyone curious about building secure networked applications in .NET and Blazor
- Server-side Blazor UI with asynchronous operations and responsive design
- Settings page with email provider presets (Gmail, Outlook, Yahoo) and connection testing
- Inbox page with email list, loading states, and refresh functionality
- Message viewer with formatted display and navigation controls
- Compose page with multi-recipient support, validation, and user feedback
- Professional styling with Bootstrap integration and custom CSS enhancements
- Error handling with user-friendly messages and retry mechanisms
- Session-based state management without persistent storage
- Clean architecture with proper separation of concerns across three layers
- AbriMail.Transport – Low-level protocol implementation
ImapClientfor secure IMAP4rev1 connections and message retrievalSmtpClientfor secure SMTP (implicit TLS) and email sending- Data models:
EmailHeader,EmailMessage,MailMessageDetails, and settings - Exception handling with
ImapExceptionfor protocol errors
- AbriMail.App – Business logic layer
IMailboxServiceinterface for high-level email operationsMailboxServiceimplementation with session-based state management- DTOs for clean data transfer:
MailHeaderDto,MailMessageDto,SendEmailDto - Connection state tracking and validation
- AbriMail.Web – Blazor Server application
- Razor components for Settings, Mailbox (inbox), Message view, and Compose
- Professional UI with Bootstrap styling and loading states
- Email provider presets (Gmail, Outlook, Yahoo) for quick setup
- Comprehensive error handling and user feedback
- Dependency injection setup in
Program.cs
- Clone the repository and open AbriEmailClient.sln in Visual Studio or VS Code.
- Update your IMAP/SMTP server details in the Settings page at runtime.
- Navigate to Inbox to fetch new messages.
- Use Compose to send emails immediately.
- No persistent storage or caching of messages
- No support for attachments or advanced MIME parts
- Read-only message retrieval (no flags, search, or folder management)
- No OAuth or modern token-based authentication (plain username/password only)
This project is licensed under the MIT License. See LICENSE for details.
AbriMail.Transport (Class Library):
- handles low-level email protocol communication.
- contains classes to connect to mail servers and execute raw IMAP and SMTP commands over TLS.
- establishing SslStream connections, sending protocol commands, and reading server responses.
- isolates the complexity of the IMAP/SMTP protocols from the rest of the app.
- Documentation: AbriMail.Transport README
AbriMail.App (Class Library):
- business logic layer that uses Mailbox.Transport.
- provides methods to the UI for common operations: e.g. “fetch inbox messages” or “send email”.
- calls Transport to perform IMAP/SMTP actions and then parses the results into simple C# models.
- handles any necessary logic like selecting the mailbox or formatting an email for sending.
- acts as a service that the Blazor UI can consume (via dependency injection) without dealing with protocol details.
- Documentation: AbriMail.App README
AbriMail.Web (Blazor Server App):
- Blazor Server web application providing the user interface
- contains Razor pages/components for settings, inbox list, email viewing, and composition.
- uses dependency injection to get the AbriMail.App services
- wires up configuration and registers the services from AbriMail.App and AbriMail.Transport in the DI container