Client error: 'POST https://api.mailgun.net/v3/sandbox75c537762edc4d29becf4de26ec1738b.mailgun.org/messages.mime' resulted in a '400 BAD REQUEST

0

I am implementing Mailgun in Laravel. I did all the configuration and from localhost it works perfect, but when I deploy in Heroku I get the following error:

  

Client error: POST https://api.mailgun.net/v3/sandbox75c537762edc4d29becf4de26ec1738b.mailgun.org/messages.mime   resulted in a 400 BAD REQUEST response: {"message": "Sandbox   subdomains are for test purposes only. Please add your own domain or   add the address to authoriz (truncated ...)

I am using my own domain, I do not know what will be failing, but in localhost the emails are sent without problem.

.env file

MAIL_DRIVER=mailgun 
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=1567---ca----b3f74f23fe
MAIL_ENCRYPTION=tls
MAILGUN_DOMAIN=email.Mydomain.co
MAILGUN_SECRET=key-03be65a7c90-----f51d---83e4

Services

    'mailgun' => [
    'domain' => env('MAILGUN_DOMAIN'),
    'secret' => env('MAILGUN_SECRET'),
],
    
asked by Cesar Augusto 27.07.2017 в 22:06
source

1 answer

1

Apparently it is a problem that does not update the changes made to the .env file - > I will investigate more on this topic.

I solved it in the following way in case someone has the same problem:

I replaced the lines in the services.php file:

they were originally like this:

'mailgun' => [
    'domain' => env('MAILGUN_DOMAIN'),
    'secret' => env('MAILGUN_SECRET'),
],

I replaced them with:

'mailgun' => [
    'domain' => ('email.Mydomain.co'),
    'secret' => ('key-03be65a7c90-----f51d---83e4'),
],

I do not know why, but according to the documentation it's like the original mines say, however, when replacing them it works.

    
answered by 27.07.2017 в 23:13