MAILGUN_DOMAIN is the domain, not the endpoint. MAILGUN_ENDPOINT is for that https://laravel.com/docs/9.x/mail#mailgun-driver
Mailgun api 503 RCPT command expected
Hi all,
I have tried to set up Mailgun with my Laravel app. I managed to configure the SMTP, works just fine. But when trying to set up the API I am not able to deliver emails and actually get an error as such "503 RCPT command expected"
In my .env I have the following setup:
MAIL_MAILER=mailgun
MAILGUN_DOMAIN=https://api.eu.mailgun.net/v3/MY_DOMAIN
MAILGUN_SECRET=MY_API_SECRET_KEY
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
While in the config/mail.php
'mailgun' => [
'transport' => 'mailgun',
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS'),
'name' => env('MAIL_FROM_NAME'),
],
],
Am I missing something?
Thank you, Mihail
@Sinnbeck, I figured out what was the issue. Basically in the MailgunTransport class, there is a private $endpoint which if not passed when called it will be set to null and when null it takes api.mailgun.net as default. Since I am in the EU I needed the default to be api.eu.mailgun.net. Which fixed the issue.
Please or to participate in this conversation.