> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailofly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel

# Sending with Laravel

Configure Laravel's native mailer to send via Mailofly SMTP.

***

## Configuration (`.env`)

Add the following environment variables to your `.env` file:

```env theme={null}
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailofly.com
MAIL_PORT=587
MAIL_USERNAME=mailofly
MAIL_PASSWORD=mfly_live_your_api_key_here
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="notifications@yourcompany.com"
MAIL_FROM_NAME="${APP_NAME}"
```

***

## Testing Laravel Mail

Run the following tinker command to test delivery:

```bash theme={null}
php artisan tinker
```

```php theme={null}
Mail::raw('Testing Mailofly SMTP from Laravel!', function ($message) {
    $message->to('alex@example.com')->subject('Laravel Test Email');
});
```


## Related topics

- [Introduction](/smtp/introduction.md)
- [Integrations](/integrations/index.md)
- [What sending feature to use?](/guides/sending/what-sending-feature-to-use.md)
- [Examples](/examples/index.md)
