tribungbu tribungbu - 6 months ago 130
PHP Question

Using mailgun on laravel 5.2 - failed to authenticate my sandbox account

I'm using Laravel 5.2 that has mailgun integrated. Was trying to send out email via SMTP but couldn't succeed because of the error:


Failed to authenticate on SMTP server with username
"postmaster@sandboxe56d93c917b144e98a4f07d1dbf2683a.mailgun.org" using
3 possible authenticators


I'm developing the app on my localhost with virtual host set up (i.e.
app.dev.local
) so I have to use the sandbox account to do all the testing.

These are the laravel's
config/mail.php
:

'driver' => env('MAIL_DRIVER', 'mailgun'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => null, 'name' => null],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => 'postmaster@sandboxe56d93c917b144e98a4f07d1dbf2xxxx.mailgun.org',
'password' => 'mypassword'


service.php
's configurations

'mailgun' => [
'domain' => 'sandboxe56d93c917b144e98a4f07d1dbf2xxxx.mailgun.org',
'secret' => 'key-63sztbx99h-qdhp7j3-gp6346jsxxxx',
],


Everything looks good as I copied directly from my mailgun dashboard for the sandbox account, but the app still can't send out email due to failed authentication.

Does anybody know what is happening here?

Answer

Try with post 2525 maybe? You can edit it in the config/mail.php file where 587 is currently or through setting it in your .env file:

MAIL_POST=2525