vinworld / vinmail
Official PHP and Laravel SDK for the VinMail transactional email API.
v0.1.0
2026-11-24 10:43 UTC
Requires
- php: >=8.1
- ext-curl: *
- ext-json: *
Requires (Dev)
None
Suggests
- illuminate/mail: Enables automatic Laravel Mail driver registration (MAIL_MAILER=vinmail).
- symfony/mailer: Required when using VinMailTransport with Laravel Mail.
Provides
None
Conflicts
None
Replaces
None
README
Official PHP 8.1+ & Laravel SDK for the VinMail transactional email API.
Includes both a standalone PHP client (zero Composer dependencies, uses native cURL) and automatic Laravel Mail driver integration (MAIL_MAILER=vinmail).
Installation
composer require vinworld/vinmail
Quick Start (Plain PHP or Laravel)
use VinWorld\VinMail\Attachment; use VinWorld\VinMail\VinMailClient; $vinmail = new VinMailClient(getenv('VINMAIL_API_KEY')); $result = $vinmail->emails->send([ 'from' => 'YourApp <no-reply@yourdomain.com>', 'replyTo' => 'contact@yourdomain.com', 'to' => 'customer@example.com', 'subject' => 'Your Invoice #1042', 'html' => '<p>Thank you for your business!</p>', 'text' => 'Thank you for your business!', 'attachments' => [ Attachment::fromPath(__DIR__ . '/invoice-1042.pdf'), ], ], idempotencyKey: 'invoice-1042'); echo $result['id'];
Laravel Drop-In Mail Driver (MAIL_MAILER=vinmail)
- Add your API key to
.env:MAIL_MAILER=vinmail VINMAIL_API_KEY=vm_live_your_key_here MAIL_FROM_ADDRESS=no-reply@yourdomain.com MAIL_FROM_NAME="YourApp"
- Add the mailer entry in
config/mail.phpundermailers:'vinmail' => [ 'transport' => 'vinmail', ],
- Add to
config/services.php:'vinmail' => [ 'key' => env('VINMAIL_API_KEY'), ],
- Keep using standard Laravel
Mail::to($user)->send(new WelcomeMail())— or use theVinMailfacade directly:use VinWorld\VinMail\Laravel\Facades\VinMail; VinMail::emails()->send([ 'to' => $user->email, 'template' => 'otp', 'variables' => ['appName' => 'YourApp', 'code' => '482913', 'minutes' => 10], ]);
Check Delivery Status
$details = $vinmail->emails->get('em_...');
Business Attachment Policy
Allowed formats: PDF, DOC/DOCX, XLS/XLSX, CSV, PPT/PPTX, TXT, RTF, PNG, JPG/JPEG, WEBP, GIF.
Limits: up to 5 files, 5 MB per file, 7.5 MB combined per email.