When I send it doesn't give me any errors, but I don't receive any email neither. I fixed all the DNS records and it has the green checkmarks by Mailgun
my .env looks like this:
MAIL_MAILER=mailgun
MAIL_HOST=smtp.eu.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=[postmaster username from mailgun]
MAIL_PASSWORD=[smtp password from mailgun]
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS[postmaster email]
MAIL_FROM_NAME=Webpage
I fixed the config.services like the Laravel documentation says
'mailgun' => [
'domain' => 'your-mailgun-domain',
'secret' => 'your-mailgun-key',
'endpoint' => 'api.eu.mailgun.net',
],
and did
composer require guzzlehttp/guzzle
in my App\Mail folder I have Discount.php
class Discount extends Mailable
{
use Queueable, SerializesModels;
public $request;
public $discount;
public function __construct($request, $discount)
{
$this->request = $request;
$this->discount = $discount;
}
public function build()
{
return $this->markdown('emails.discount')
->replyTo($this->request['email']);
}
}
and lastly, in my controller I have
public function find ()
{
[ ... ]
Mail::to('myemail@mywebsite.com')->send(new Discount($request, $discount));
return redirect()->back()->with('success', true);
}
Every time I send it hits the return with 'success' but I get no email