All Laravel Maily configuration lives under theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/yugo412/laravel-maily/llms.txt
Use this file to discover all available pages before exploring further.
maily key in config/services.php. The package reads this configuration at send time — there is no separate published config file to manage. Sensitive values such as your API key are loaded from environment variables via env(), keeping credentials out of your codebase and making it straightforward to use different keys across local, staging, and production environments.
services.php
Add the following block to yourconfig/services.php file:
Environment variables
Add the following entries to your.env file. Only MAILY_KEY and MAIL_MAILER are strictly required; the remaining variables have sensible defaults and can be omitted until you need to tune them.
Configuration reference
Your Maily API key. Obtain this from the Maily.id dashboard after creating an account. The key is passed to the API via the
X-API-Key request header on every send call.Base URL for the Maily REST API. Override this if you are targeting a staging or self-hosted Maily instance. The transport appends
/api/v1/emails/send to this value when making requests.Maximum number of seconds to wait for an HTTP response from the Maily API before the request is considered to have timed out. Increase this value on slow network links; decrease it for stricter latency budgets.
Maximum number of times the request will be attempted when a connection-level failure is detected. A value of
3 means up to three total attempts. Set to 0 to disable retries entirely.Delay in milliseconds between retry attempts. The default of
1000 introduces a one-second pause between each attempt to give transient network issues time to resolve before trying again.Retry behavior
Retries are handled exclusively for connection-level failures. If the Maily API returns an HTTP error response (4xx or 5xx), no retry is attempted — aMailyTransportException is thrown immediately. Retries only trigger when Laravel’s HTTP client raises a ConnectionException, which represents a failure to establish or maintain the TCP connection itself. This prevents hammering the API with repeated requests when the failure is on the server side rather than the network.
The retry logic is implemented in MailyTransport using Laravel’s built-in Http::retry() with throw: false. The times parameter controls the maximum number of total attempts. When throw: false is set, ConnectionException is suppressed during intermediate attempts, but is still re-thrown once all attempts are exhausted:
ConnectionException, the transport catches the final exception and throws a MailyTransportException with the message "Could not connect to the Maily API.", which Laravel’s mailer will surface to your application as a standard send failure.