Derafu: Mail - Elegant orchestration of email communications for PHP
A flexible PHP email library, built on Derafu Backbone architecture, that leverages other libraries and orchestrates the entire sending and receiving process.
Overview
Derafu Mail provides a robust, extensible framework for sending and receiving emails in PHP applications. Built on the Derafu Backbone architecture, it offers a clean, maintainable structure with clear separation of concerns.
Features
- Clean Architecture: Follows the Derafu Backbone hierarchical structure.
- Sending Emails: SMTP support with easy extensibility for other transport methods.
- Receiving Emails: IMAP support with customizable search criteria and filtering.
- Flexible Configuration: Comprehensive options for both sending and receiving.
- Robust Error Handling: Proper exception handling throughout the library.
- Attachment Management: Support for both sending and receiving attachments.
- Strategy Pattern: Easily swap out sending/receiving implementations.
Installation
Install the package via Composer:
Quick Start
Sending Emails
Receiving Emails
Extending with New Strategies
The library is designed to be easily extended with new sending or receiving strategies:
- Create a new strategy class implementing
SenderStrategyInterface
orReceiverStrategyInterface
. - Tag it with the appropriate attribute.
Example:
Architecture
Derafu Mail follows the Derafu Backbone architecture:
- Package: MailPackage - The main entry point.
- Component: ExchangeComponent - Handles email exchange.
- Workers: SenderWorker and ReceiverWorker - Handle sending and receiving.
- Handlers: SendHandler and ReceiveHandler - Orchestrate the process.
- Strategies: Implement different methods of sending or receiving.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This package is open-sourced software licensed under the MIT license.