You see, I have in my project to send a message to a user.
This is the code for sending the message:
Mail::to($usuario->email)->send(new Dispulpa($usuario->name.' '.$usuario->second_name, $oferta->titulo));
This is the file Sorry.php:
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class Disculpa extends Mailable{
use Queueable, SerializesModels;
public $gesto, $tipo;
public function __construct($gesto, $tipo){
$this->gesto=$gesto;
$this->tipo=$tipo;
}
public function build(){
return $this->view('correo.disculpa');
}
}
And this is the view to which it leads:
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
<title>Sentimos comunicarle que se cancelo la oferta de trabajo</title>
</head>
<body>
<p>La oferta de trabajo de {{$tipo}}, que pidiste en Bolsa Empleo San Fernando se ha eliminado.</p><br>
<p>Pero no te desanimes, {{$gesto}}, puede que dentro de poco encuentras otra oferta de trabajo</p><br>
<p>¡Que te vaya bien la proxima vez!</p>
</body>
</html>
But I see myself with this:
I do not know what may be failing. I have another Mail file and that, on the contrary, it works.
Edit: I add my imports.
namespace App\Http\Controllers;
use Mail;
use Validator;
use Illuminate\Http\Request;
use \App\Oferta;
use \App\Mail\Dispulpa;
use \App\Inscribe;
use \App\User;