Laravel Quickstart
Send Laravel mailables through the Arawa Mail HTTP API with the
sharasolns/sdp-email Composer
package. It supports queued mail, Markdown mail, attachments, CC, BCC,
reply-to addresses, and custom headers.
Before You Begin
- Add and verify your sending domain in Arawa Mail.
- Enable outbound sending for the domain.
- Create an API key with the
sendingscope.
The sender configured in Laravel must use that enabled domain. A domain-restricted API key must also allow the sender's domain.
1. Install the Package
composer require sharasolns/sdp-email
Laravel discovers the package automatically. You do not need to edit
config/mail.php or config/services.php.
2. Configure Laravel
In the application's .env file, change the existing MAIL_MAILER value:
MAIL_MAILER=sdp
Then add your Arawa Mail API key:
SDP_EMAIL_KEY=your_api_key
Check the existing MAIL_FROM_ADDRESS value and make sure it uses a domain
enabled for outbound sending. You do not need to add another sender setting if
it is already correct.
If configuration is cached in production, rebuild it:
php artisan config:cache
3. Send an Email
Use Laravel Mail normally:
use Illuminate\Support\Facades\Mail;
Mail::raw('Sent through Arawa Mail.', function ($message) {
$message
->to('[email protected]')
->subject('Hello from Laravel');
});
Existing mailables require no provider-specific code:
use App\Mail\OrderShipped;
use Illuminate\Support\Facades\Mail;
Mail::to($order->customer)->send(new OrderShipped($order));
Queue Mail
Queued mail uses the same transport:
Mail::to($order->customer)->queue(new OrderShipped($order));
Run a Laravel queue worker when using queued mail:
php artisan queue:work
Optional Connection Settings
The package uses the production endpoint and a 10-second timeout by default:
SDP_EMAIL_ENDPOINT=https://app.arawamail.com
SDP_EMAIL_TIMEOUT=10
Troubleshooting
If Laravel continues using another mailer after changing .env, clear the
configuration cache:
php artisan config:clear
Sending is rejected when the sender's domain is not registered, outbound
sending is inactive, the API key lacks the sending scope, or a restricted key
does not allow the sender's domain.