I am trying to send emails with mailgun, but they are not sent, and I have no idea why, because I am not getting any errors at all.
This is my code:
mail.php:
'driver' => env('MAIL_DRIVER', 'mailgun'),
services.php:
'mailgun' => [
'domain' => env('sandbox1e...60.mailgun.org'),
'secret' => env('key-146...419'),
],
EmailController.php:
public function send($email, $uuid = null)
{
if($uuid == null){
$uuid = User::get()->where('customer_email' , $email)->first()->email_confirmed;
}
return Mail::to($email)->send(new ConfirmEmail($uuid));
}
ConfirmEmail.php:
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class ConfirmEmail extends Mailable
{
use Queueable, SerializesModels;
public $uuid;
public function __construct($uuid)
{
$this->uuid = $uuid;
}
public function build()
{
return $this->from('mailgun@sandbox1e17506823f2490ba9cc78cbbc2adb60.mailgun.org')
->view('emails.confirm');
}
}
I added the email address I want to send to mailgun, but it does not work. Am I doing something wrong or can I debug this?
source
share