akinsoftdev / sendinboxmail-laravel
SendInboxMail Mail Transport Driver for Laravel - A seamless integration for sending emails through SendInboxMail API
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/akinsoftdev/sendinboxmail-laravel
Requires
- php: ^8.1
- illuminate/contracts: ^10.0|^11.0|^12.0
- illuminate/http: ^10.0|^11.0|^12.0
- illuminate/mail: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
- symfony/mailer: ^6.0|^7.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- laravel/pint: ^1.0
- orchestra/testbench: ^8.0|^9.0|^10.0
- pestphp/pest: ^2.0|^3.0
- phpstan/phpstan: ^1.10
README
A seamless Laravel mail transport driver for SendInboxMail email service. This package allows you to send emails through SendInboxMail API with full Laravel Mail integration.
Requirements
- PHP 8.1 or higher
- Laravel 10.x, 11.x, or 12.x
Installation
You can install the package via composer:
composer require akinsoftdev/sendinboxmail-laravel
The package will automatically register its service provider.
Configuration
1. Publish the Configuration File
php artisan vendor:publish --tag="sendinboxmail-config"
This will create a config/sendinboxmail.php file in your application.
2. Environment Variables
Add the following variables to your .env file:
SENDINBOXMAIL_URL=https://your-sendinboxmail-api-url.com/send SENDINBOXMAIL_API_KEY=your-api-key SENDINBOXMAIL_NEWS_ID=1 SENDINBOXMAIL_SENDER_ID=1 SENDINBOXMAIL_TIMEOUT=30 SENDINBOXMAIL_RETRY_TIMES=3
3. Configure Mail Driver
Add the SendInboxMail mailer to your config/mail.php file:
'mailers' => [ // ... other mailers 'sendinboxmail' => [ 'transport' => 'sendinboxmail', ], ],
4. Set as Default (Optional)
To use SendInboxMail as your default mailer, update your .env:
MAIL_MAILER=sendinboxmail
Usage
Using as Default Mailer
Once configured as default, all your emails will be sent through SendInboxMail:
use Illuminate\Support\Facades\Mail; use App\Mail\WelcomeEmail; Mail::to('user@example.com')->send(new WelcomeEmail());
Using Explicitly
You can also explicitly use the SendInboxMail mailer:
Mail::mailer('sendinboxmail') ->to('user@example.com') ->send(new WelcomeEmail());
Sending Raw Email
Mail::mailer('sendinboxmail')->raw('Hello World!', function ($message) { $message->to('user@example.com') ->subject('Test Email'); });
With Mailable Class
<?php namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Illuminate\Queue\SerializesModels; class WelcomeEmail extends Mailable { use Queueable, SerializesModels; public function envelope(): Envelope { return new Envelope( subject: 'Welcome to Our Platform', ); } public function content(): Content { return new Content( view: 'emails.welcome', ); } }
Inline Attachments
The package supports inline attachments (embedded images):
<img src="{{ $message->embed(public_path('images/logo.png')) }}" alt="Logo">
Configuration Options
| Option | Description | Default |
|---|---|---|
url |
SendInboxMail API endpoint URL | https://notify.sendinboxmail.com/manage/send.php |
apikey |
Your SendInboxMail API key | - |
news_id |
Campaign/News identifier | - |
sender_id |
Sender profile identifier | - |
timeout |
Request timeout in seconds | 30 |
retry_times |
Number of retry attempts | 3 |
Error Handling
The package throws SendInboxMailException for any API errors:
use Akinsoft\SendInboxMail\Exceptions\SendInboxMailException; try { Mail::mailer('sendinboxmail')->to('user@example.com')->send(new WelcomeEmail()); } catch (SendInboxMailException $e) { // Handle the exception Log::error('SendInboxMail Error: ' . $e->getMessage()); }
Testing
composer test
Code Style
This package uses Laravel Pint for code styling:
composer format
Static Analysis
Run PHPStan for static analysis:
composer analyse
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Security Vulnerabilities
If you discover a security vulnerability, please send an email to programlama@akinsoft.com.tr. All security vulnerabilities will be promptly addressed.
Credits
License
The MIT License (MIT). Please see License File for more information.