Did you check the .env file that is in the server? Usually when you use forge or other services like that, the .env file needs to be configured a part.
Mailgun gives 401 unathorized response
I was using my gmail account to send emails while working on localhost, but after uploading to the server the emails weren't going and t would give me an error in the page, so I assume it has to do with google security and decided to use mailgun, which am currently testing on local environment.
I created a new email with my domain [email protected] for the mailgun account.
In the .env I have the following:
MAIL_DRIVER=mailgun MAILGUN_DOMAIN=sandbox16261edfb1b94ea960061b8ce6e.mailgun.org MAILGUN_SECRET=g333c6d0-46a333e32
Did the setup in mail.php
'driver' => env('MAIL_DRIVER', 'mailgun'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'Admin'),
],
I also edited the services.php
'mailgun' => [
'domain' => 'sandbox16ddd1edfb1dd4e9ab89addd061b8ce6e.mailgun.org',
'secret' => 'bddddd0-46a0de32',
],
I also added guzzle to my composer dependencies:
"require": {
"php": "^7.1.3",
"barryvdh/laravel-dompdf": "^0.8.2",
"billowapp/payfast": "^0.1.29",
"brian2694/laravel-toastr": "^5.5",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.4.0",
"maddhatter/laravel-fullcalendar": "^1.3",
"srmklive/paypal": "~1.0",
"stripe/stripe-php": "4.*",
"guzzlehttp/guzzle": "~5.3|~6.0"
},
When I try to send a email I see the following error:
Client error: `POST https://api.mailgun.net/v3/sandbox16261edfb1b94e9ab89a960061b8ce6e.mailgun.org/messages.mime` resulted in a `401 UNAUTHORIZED` response:\n
Forbidden\n
Is there anything else that I need to do?
You cannot do ANYTHING without the vendor folder.
What is recommended is that you have a hosting provider that provides console access and then you run composer install to bring in all the packages
Please or to participate in this conversation.