Controller:
$sent = Mail::to('[email protected]')->send(new Welcome($name, $email, $phone, $msg));
.env:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.dominio.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
Vista:
<h3>Contacto Web</h3>
<br>
<br>
<b>Nombre:</b> {{$name}}
<br>
<b>Email:</b> {{$email}}
<br>
<b>Teléfono:</b> {{$phone}}
<br>
<b>Mensaje:</b> {{$msg}}
Mailable:
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue;
class Welcome extends Mailable {
use Queueable, SerializesModels;
/**
* @var
*/
public $name;
public $email;
public $phone;
public $msg;
/**
* Create a new message instance.
*
* @param $name
* @param $email
* @param $phone
* @param $msg
*/
public function __construct($name, $email, $phone, $msg)
{
$this->name = $name;
$this->email = $email;
$this->phone = $phone;
$this->msg = $msg;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$address = '[email protected]';
$dest_name = 'Web';
$subject = 'Contacto Web';
return $this->view('emails.welcome')
->to($address, $dest_name)
->from($this->email, $this->name)
->subject($subject);
} }
En teoria este código me funcionaba hasta ahora y de repente ha dejado de mandar correos, no muestra ningún error. He probado de cambiar el send por queue y no cambia nada. Ya no se que más probar, he creado un mailable nuevo y lo mismo.
Versión: Laravel 5.4