Download the PHP package monkeyscloud/monkeyslegion-mail without Composer
On this page you can find all versions of the php package monkeyscloud/monkeyslegion-mail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download monkeyscloud/monkeyslegion-mail
More information about monkeyscloud/monkeyslegion-mail
Files in monkeyscloud/monkeyslegion-mail
Package monkeyslegion-mail
Short Description Mail integration package for the MonkeysLegion framework.
License MIT
Informations about the package monkeyslegion-mail
MonkeysLegion Mail
A powerful, feature-rich mail package for the MonkeysLegion PHP framework, providing robust email functionality with DKIM signing, queue support, rate limiting, and elegant template rendering.
📋 What's Inside
This comprehensive mail package includes everything you need for professional email handling:
🚀 Getting Started
- Quick Installation: Automated setup with scaffolding
- Configuration: Environment variables and driver setup
- First Email: Send your first email in minutes
📧 Core Email Features
- Multiple Transports: SMTP, Sendmail, Mailgun, and Null drivers
- Direct Sending: Immediate email delivery
- Queue System: Background email processing with Redis
- Rate Limiting: Prevent spam and control sending limits
🛡️ Security & Authentication
- DKIM Signing: Digital signatures for email authentication
- SPF/DMARC Ready: Compatible with modern email security
- Raw Key Support: Simplified DKIM key management
🎨 Template System
- Mailable Classes: Object-oriented email composition
- ML View Engine: Powerful template rendering
- Email Components: Reusable UI components
- Dynamic Content: Data binding and conditional rendering
⚡ Advanced Features
- CLI Commands: Command-line email management
- Queue Management: Job retry, failure handling
- Logging: Comprehensive PSR-3 compatible logging
- Events: Email lifecycle tracking
🔧 Developer Tools
- Make Commands: Generate mail classes instantly
- Testing Tools: Test email sending without queues
- Debug Mode: Detailed logging and error reporting
🚀 Quick Start
Installation
Basic Configuration
Add these variables to your .env
file:
You can always check the mail.php config file to see all the available options you can set in your .env
Test Your Setup
📧 Sending Emails
Direct Sending
Queue-Based Sending
Using Mailable Classes
🎨 Mailable Classes
Mailable classes provide an elegant, object-oriented way to compose emails with templates, data binding, and fluent configuration.
Creating a Mailable
Example Mailable Class
Using Mailable Classes
Mailable Features
Template Binding
Overridable Properties
Child classes can override these properties to set defaults:
Available Configuration Methods
Method | Description | Example |
---|---|---|
setTimeout(int $timeout) |
Set job timeout in seconds | ->setTimeout(120) |
setMaxTries(int $tries) |
Set maximum retry attempts | ->setMaxTries(5) |
setContentType(string $type) |
Set content type | ->setContentType('text/plain') |
addAttachment(string $path, ?string $name, ?string $mime) |
Add file attachment | ->addAttachment('/path/file.pdf', 'Invoice.pdf') |
setAttachments(array $attachments) |
Set all attachments | ->setAttachments($fileArray) |
Attachments
Conditional Logic
📊 Queue System
The queue system allows you to send emails in the background, improving application performance and providing retry capabilities.
How It Works
- Queue Email: Email is serialized and stored in Redis
- Worker Processing: Background worker picks up jobs
- Retry Logic: Failed jobs are automatically retried
- Failure Handling: Permanently failed jobs are moved to failed queue
Queue Benefits
- Performance: Non-blocking email sending
- Reliability: Automatic retries for failed sends
- Scalability: Multiple workers can process jobs
- Monitoring: Track job status and failures
Example Queue Workflow
Queue Monitoring
🔧 CLI Commands
The mail package includes powerful CLI commands for testing, queue management, and maintenance.
Email Testing
DKIM Key Generation
- This will create
dkim_private.key
anddkim_public.key
in the given directory. - Add the public key to your DNS as a TXT record for DKIM.
Queue Management
Queue Worker Configuration
Configure worker behavior in config/redis.php
:
🛡️ DKIM Email Signing
DKIM (DomainKeys Identified Mail) adds digital signatures to your emails, improving deliverability and preventing spoofing.
Why DKIM Matters
- Improved Deliverability: Emails are more likely to reach the inbox
- Authentication: Proves emails actually came from your domain
- Reputation Protection: Prevents others from spoofing your domain
- Compliance: Required by many enterprise email systems
Setting Up DKIM
1. Generate DKIM Keys
2. Configure Environment
3. Add DNS Record
Create a TXT record in your DNS:
4. Verify DKIM
DKIM Features
- Automatic Signing: All emails are automatically signed when configured
- Raw Key Support: No need for PEM headers - just paste the key data
- Transport Compatibility: Works with SMTP, Mailgun, and other transports
- Queue Preservation: DKIM signatures are preserved through queue processing
⚙️ Configuration
Driver Configuration
SMTP Driver
Mailgun Driver
Null Driver
Sendmail Driver
Rate Limiting
Configure rate limiting in config/rate_limiter.php
:
🎯 Rate Limiting
Prevent spam and control email sending rates with built-in rate limiting.
Configuration
Rate limiting is configured in the config/rate_limiter.php
file:
Available Methods
Scheduled Cleanup
Add to your cron jobs:
🎨 Template System
Create beautiful, reusable email templates with the ML View engine.
For complete template documentation, see: MonkeysLegion Template Engine
Email Components
The package includes pre-built email components
📝 Logging
Comprehensive logging helps you monitor email delivery and debug issues. Logging behavior is controlled by your application mode in the .env
file.
Configuration
Logging is automatically configured based on your application environment:
Log Levels by Environment
Production Mode (APP_ENV=prod
)
- INFO: Successful operations, performance metrics
- WARNING: Rate limits, retry attempts
- ERROR: Failed operations, configuration issues
- CRITICAL: System failures requiring immediate attention
Development Mode (APP_ENV=dev
)
- DEBUG: Detailed SMTP communication, DKIM signing process
- INFO: All successful operations with timing data
- WARNING: Non-critical issues and suggestions
- ERROR: Failed operations with full stack traces
Testing Mode (APP_ENV=test
)
- ERROR: Only failures and critical issues
- INFO: Test-specific events and assertions
Log Examples
Log File Locations
Logs are stored in different locations based on your environment:
Custom Logging
🚀 Advanced Usage
Multiple Drivers
Bulk Email Processing
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
📄 License
This package is open-sourced software licensed under the MIT license.
🆘 Support
- Documentation: MonkeysLegion Mail Package
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: to add later ...
Made with ❤️ by the MonkeysLegion Team
All versions of monkeyslegion-mail with dependencies
league/commonmark Version ^2.7
monkeyscloud/monkeyslegion-core Version ^1.0
monkeyscloud/monkeyslegion-cli Version ^1.0
monkeyscloud/monkeyslegion-di Version ^1.0
monkeyscloud/monkeyslegion-template Version ^1.0
psr/log Version ^3.0
vlucas/phpdotenv Version ^5.6