I read everything I can and looks like I set it up and fill in everywhere according to the docs (and internet) but still cant receive any emails.
I need to use MailGun API so I can send emails from my localhost as well as from the test and prod + because 25 port usually closed.
I filled in everything I can just in case some miracle happen (was changing between smtp/mailgun in .env
)
I have tried both my real server settings and when I fail tried without any success sandbox as well.
my mailgun data access (some letters hidden):
-
my mailgun sandbox server http://i.imgur.com/XCi8Hkn.png
-
when i click to it i have an option to choose between API and SMTP
2.1 in API tab i have API KEY: http://i.imgur.com/xGSq7aF.png
2.2 in SMTP box i have smtp host, port, login, passwd: http://i.imgur.com/t5Pi6lH.png - my
.env
:
MAIL_DRIVER=mailgun
MAILGUN_DOMAIN=sandbox8ffexxxxxxxxxxxxxad0cf6b4da3c2.mailgun.org
MAILGUN_SECRET=b3ff30bxxxxxxxxxxxxxxxx087d-f877bd7a-01ecceaa
MAIL_HOST=smtp.eu.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=postmaster@sandbox8ffexxxxxxxxxxd0cf6b4da3c2.mailgun.org
MAIL_PASSWORD=f5978ef9xxxxxxxxxx5c5312e-f877bd7a-f9cb0e60
MAIL_ENCRYPTION=null
somewhere in internet found that MAILGUN_DOMAIN & MAILGUN_SECRET could be added in .env
so tried them here as well
config/mail.php
'driver' => env('mailgun', 'mailgun'),
'host' => env('smtp.eu.mailgun.org', 'smtp.mailgun.org'),
'port' => env('587', 587),
'from' => [
'address' => env('support@mail.mydomain.one', 'hello@example.com'),
'name' => env('mydomain.one Service', 'Example'),
],
'username' => env('postmaster@sandbox8ffexxxxxxxxxxd0cf6b4da3c2.mailgun.org'),
'password' => env('f5978ef9xxxxxxxxxx5c5312e-f877bd7a-f9cb0e60'),
app/mail/Test.php
public function build()
{
return $this->from('support@mail.mydomain.one')
->view('test');
}
TestController
use App\Mail\Test;
use Illuminate\Support\Facades\Mail;
class TestController extends Controller
{
public function test()
{
echo 'hello';
try {
Mail::to('myaddress@gmail.com')->send(new Test());
} catch (\Exception $e) {
dump($e);
}
echo 'hello2';
}
}
resources/views/test.blade.php
hello
- was using even so just in case
> artisan cache:clear
> artisan config:cache
> artisan cache:clear
please help, what is missing ? what i did wrong ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire