Error because I do not recognize the Mail file

0

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;
    
asked by Miguel Alparez 02.05.2018 в 23:02
source

1 answer

0

I already managed to solve it, although it is something strange: The only thing I did was create a new Mail file, which I called "Llamada.php" and copy the code of Disculpa.php inside, and voila, I finally managed to send the email! To the conclusion that arrived is that for some reason it does not like to Laravel that a Mail file is called "Excuse.php". Before trying this probe everything, including copying the code of Sorry.php in another Mail that did work, which to my surprise also served as a "solution".

    
answered by 03.05.2018 в 00:05