The application no longer uses RabbitMQ for command publishing and consumption. This commit removes all RabbitMQ-related code, including:
- Removed RabbitMQ service registrations in `DependencyInjection.cs`.
- Deleted `RabbitMqCommandConsumer.cs`, which implemented a background service for consuming commands.
- Deleted `RabbitMqCommandPublisher.cs`, which implemented a publisher for RabbitMQ-based commands.
- Removed RabbitMQ-specific properties (`ExchangeName`, `QueueName`, `RoutingKey`) from `RabbitMqConfiguration.cs`.
These changes reflect a shift in the application's messaging strategy or architecture.
Introduced a dedicated `EmailSenderWorkerConfiguration` class to centralize and simplify configuration management for the `EmailSenderWorker`. Updated `Program.cs` to use this class for dependency injection and removed the inline configuration logic from `EmailSenderWorker.cs`.
Simplified the worker's constructor by leveraging `IOptions<EmailSenderWorkerConfiguration>`. Removed the unused `MaxRetryCount` property from the configuration class and `appsettings.json`.
Cleaned up `using` directives in `Program.cs` and `EmailSenderWorker.cs` to include the new namespace and remove redundant imports. These changes improve maintainability and align with best practices.
Added a reference to the `System.Security.Cryptography.Xml`
package (version 10.0.10) in the project file to enable
XML cryptographic operations such as signing, verifying,
and encrypting XML data. This change enhances the project's
capabilities for handling secure XML processing.
Replaced the `EncryptedPassword` property in `EmailAccountDto` with `Password` and `PasswordEncrypted` to support both plain text and encrypted passwords. Updated `LimilabsEmailService` to use the new properties, checking the `PasswordEncrypted` flag to determine whether decryption is needed.
The `EmailAccount` section has been removed entirely, including
properties such as `Username`, `SmtpServer`, `SmtpPort`,
`SmtpUseSsl`, and `UseOAuth2`. No changes were made to the
`EmailSender` section or the `LuckyPennySoftLicenseKey`.
Refactored `EmailAccountDto` to focus on SMTP-related properties, removing unused fields. Updated `DependencyInjection` to configure data protection with a new key storage path. Simplified `DataProtectionEncryptionService` by removing redundant checks and error handling for encryption and decryption methods.
- Add static constructor to register System.Text.Encoding.CodePages
- Required for windows-1252 and other extended code page support
- Fixes encoding issues with international email content
- Add license key reading from appsettings.json
- Configure AutoMapper 16.2.0+ with built-in DI extension and license key
- Configure MediatR 14.2.0+ with license key
- Update Program.cs to pass IConfiguration to AddApplicationServices
The `DigitalData.EmailProfiler.Application.csproj` file was updated to downgrade `AutoMapper` and `AutoMapper.Extensions.Microsoft.DependencyInjection` from versions `16.2.0` and `12.0.0` to `12.0.1`. Additionally, a new dependency on `FluentValidation.DependencyInjectionExtensions` version `12.1.1` was added.
The `DigitalData.EmailProfiler.Infrastructure.csproj` file was updated to downgrade the `AutoMapper` package from version `16.2.0` to `12.0.1`.
These changes address potential compatibility issues and introduce FluentValidation for dependency injection.
Controllers:
- EmailProfilesController: CRUD operations (GET sync, POST/PUT/DELETE async via RabbitMQ)
* GET /api/emailprofiles - List all profiles
* GET /api/emailprofiles/{id} - Get profile by ID
* GET /api/emailprofiles/active - List active profiles
* POST /api/emailprofiles - Create (202 Accepted, queued to RabbitMQ)
* PUT /api/emailprofiles/{id} - Update (202 Accepted, queued to RabbitMQ)
* DELETE /api/emailprofiles/{id} - Delete (202 Accepted, queued to RabbitMQ)
- EmailAccountsController: CRUD operations
* GET /api/emailaccounts - List all accounts
* GET /api/emailaccounts/{id} - Get account by ID
* POST /api/emailaccounts - Create (202 Accepted, queued to RabbitMQ)
- EmailHistoryController: Read-only operations
* GET /api/emailhistory/profile/{profileId} - Get history with pagination
* GET /api/emailhistory/{id} - Get history by ID
Changes:
- Fix ICommandPublisher constraint: IRequest → IBaseRequest (supports IRequest<T>)
- All POST/PUT/DELETE return HTTP 202 Accepted (async processing)
- All GET operations return HTTP 200 OK (synchronous via MediatR)
- Proper error handling: 404 Not Found for missing resources
- Move EmailAccountDto.cs to Dtos/ (was in EmailAccounts/ subfolder)
- Move EmailProfileDto.cs to Dtos/ (was in EmailProfiles/ subfolder)
- Keep EmailAttachments/ (3 DTOs) and EmailHistories/ (3 DTOs) subfolders
- Update all namespace imports from Dtos.EmailAccounts/EmailProfiles to Dtos
- Simpler structure: single DTOs at root, multiple DTOs in subfolders
- Consolidated commands and handlers into single files for better organization.
- Updated file naming conventions for commands and queries.
- Added explicit Git operation rules to prevent automatic commits/pushes.
- Introduced new projects and restructured solution file (`legacy` folder).
- Refactored `CreateEmailAccountCommand`, `ProcessEmailCommand`, and others to use `IUnitOfWork`.
- Enhanced `ProcessEmailCommandHandler` with attachment validation and error handling.
- Removed redundant handler files after consolidation.
- Improved code consistency and added `TODO` comments for future enhancements.
CRITICAL FIX: Replace all DateTime.UtcNow with DateTime.Now throughout the application.
Reason: Legacy VB.NET system uses local server time, and database stores all
timestamps as local time. Using UTC breaks compatibility and causes incorrect
time comparisons.
Changes:
- EmailProcessedEvent: ProcessedDate now uses DateTime.Now
- EmailHistory.MarkAsProcessed(): ProcessedDate now uses DateTime.Now
- EmailHistory.MarkAsFailed(): ProcessedDate now uses DateTime.Now
- EmailProfile.UpdateLastPollTime(): LastPollTime now uses DateTime.Now
- EmailProfile.ShouldPoll(): Poll interval comparison now uses DateTime.Now
Documentation:
- Added critical note to agents.md about DateTime usage
- Includes examples and detailed explanation for future developers
This ensures all date/time operations remain compatible with legacy database.
A new "Solution Items" folder has been added to the solution, represented by the GUID `{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}`.
This folder includes the following files:
- `agents.md`
- `IMPLEMENTATION_GUIDE.md`
- `README.md`
- `STATUS.md`
These files are now part of the solution structure, providing better organization and accessibility for project-related documentation.
Comprehensive analysis of the VB.NET legacy system:
- Complete database schema documentation
- All table structures (TBDD_*, TBEMLP_* tables)
- Legacy business logic analysis
- VB.NET code patterns and conventions
- Migration considerations
This documentation ensures new implementation maintains compatibility
with existing database and business rules.
DTOs:
- EmailProfileDto: Profile data transfer object
- EmailAccountDto: Email account data transfer object
- EmailHistoryDto: Email history data transfer object
- EmailAttachmentDto: Attachment data transfer object
Dependencies:
- MediatR 14.2.0 for CQRS (Commands/Queries)
- AutoMapper 12.0.1 for entity-DTO mapping
- FluentValidation 12.1.1 for input validation
This provides the foundation for the application layer implementation.
- MessageId: Unique message identifier with SHA256 hash
Uses same algorithm as legacy system for duplicate detection compatibility
Hash format: SHA256({originalMessageId}|{sender}|{date}|{subject})
- EmailAddress: Email address validation and parsing with name support
Value objects ensure immutability and value-based equality.
- ErrorCode: All error codes from legacy system (10001-10010)
- ProcessType: Email process types (ProcessManager, AttachmentSniffer, ZugFeRDParser)
- AuthenticationType: Authentication methods (UsernamePassword, OAuth2)
- EmailStatus: Email processing status tracking
- AttachmentStatus: Attachment validation status
These enums maintain compatibility with the legacy VB.NET system.
- Add BaseEntity with audit fields (CreatedDate, CreatedBy, ModifiedDate, ModifiedBy)
- Add IAggregateRoot marker interface for DDD aggregate roots
- Add ValueObject base class with equality comparison by value
These classes provide the foundation for all domain entities and value objects.