Tigpezeghe Rodrige
Tigpezeghe Rodrige

Reputation: 25

Sending mails from mailgun from laravel 5.2 application

I am using laravel 5.2 with mailgun. Tried sending an email to a user in order that the user resets password. I get this error

ClientException in RequestException.php line 107: Client error: POST https://api.mailgun.net/v3/sandbox7337ad8917084e1883b28134ba711960.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...)

This is a section of my .env file

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=2525
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls

MAILGUN_DOMAIN=sandbox..........mailgun.org
MAILGUN_SECRET=key-.........

config/services.php file

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

config/mail.php file

'driver' => env('MAIL_DRIVER', 'smtp'),
host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 2525),
'from' => ['address' => '[email protected]', 'name' => 'myName'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',

Please, help.

Upvotes: 1

Views: 1532

Answers (1)

Dale Nguyen
Dale Nguyen

Reputation: 1980

This is the sandbox domain. You need to verify your own domain or verify the recipient in order to send an email to others.

Follow the link to add recipients: https://mailgun.com/app/testing/recipients

Upvotes: 3

Related Questions