laravel maintained by mailgatewayid
mailgatewayid/laravel
composer require mailgatewayid/laravel
.env:
MAIL_MAILER=mailgateway
MAILGATEWAY_API_KEY=mg_live_xxxxxxxx
MAIL_FROM_ADDRESS=no-reply@domainanda.id
Kode lama tetap jalan: Mail::to($user)->send(new OrderShipped($order));
Retry aman (Idempotency-Key, opsional, berlaku 24 jam). Tambahkan header di Mailable; untuk banyak penerima, key otomatis diberi akhiran alamat penerima:
public function headers(): \Illuminate\Mail\Mailables\Headers
{
return new \Illuminate\Mail\Mailables\Headers(text: ['Idempotency-Key' => 'invoice-' . $this->order->id]);
}
Verifikasi email & webhook:
use MailGateway\MailGateway;
app(MailGateway::class)->verify('user@gmail.com');
MailGateway::verifyWebhookSignature($request->getContent(), $request->header('X-MailGateway-Signature'), env('MAILGATEWAY_WEBHOOK_SECRET'));
Catatan: lampiran belum didukung Email API; gunakan SMTP Relay untuk email berlampiran.