After change variable MAILGUN_ENDPOINT in .env to:
MAILGUN_ENDPOINT=api.mailgun.net
Now error has changed
Unable to send an email: Forbidden (code 401).
How to fix this error?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi. Please help me. When I try to send Email with Mailgun by instruction https://laravel.com/docs/11.x/mail#mailgun-driver - I get error: "Could not reach the remote Mailgun server." - https://prnt.sc/JzAl88lGpJVU
File config/mail.php
...
'mailers' => [
'mailgun' => [
'transport' => 'mailgun',
],
....
],
File config/services.php
...
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
...
File .env
MAIL_MAILER=mailgun
MAILGUN_DOMAIN=mailgun-domain.com
MAILGUN_SECRET=secret-api-code
MAILGUN_ENDPOINT=smtp.eu.mailgun.org
How I can fix this error?
Please or to participate in this conversation.