1
I have the following routine implemented in Laravel
$prestadores = \App\Prestador::all();
Mail::send('emails.listaprestadores',['prestadores' => $prestadores],
function($message) use ($prestadores){
$message->to('[email protected]', 'Marcelo Gomes');
$message->subject('[Teste] Lista de Prestadores');
});
To View
is the code below. Does not generate exception
, but the email is not sent.
I changed the routine to send a simple email and it is sent normally.
I believe you’re doing something wrong by passing the array
, but I took the example in the documentation of Laravel
.
<!DOCTYPE html><html>
<head>
<title>Lista de Prestadores</title>
</head><body>
<table width="900" class="table table-responsive table-striped">
<thead>
<th>ID</th>
<th>Razão Social</th>
<th>CNPJ</th>
<th>Cidade</th>
</thead>
<tbody>
@foreach($prestadores as $prestador)
<tr>
<td>{{ $prestador->id ]}</td>
<td>{{ $prestador->rezao_social ]}</td>
<td>{{ $prestador->cnpj ]}</td>
<td>{{ $prestador->cidade ]}</td>
</tr>
@endforeach
</tbody>
</table><table class="table">
<tr>
<td><span class="small">TrabalhoEmDia.com - Suas tarefas em Dia - </span>/td>
</tr>
</table>
</body>
</html>
@Marcelogomers,
$prestadores
is a very large information list, maybe the email is being sent, but, blocked by the server, seen perhaps as spam, try sending an HTML email with 1 info if it is maybe this$prestadores
– novic
Also check the shipping configuration data, sometimes is using some service that requires encryption tls or ssl...even the smtp address may be wrong...
– Kenny Rafael