0
This sending all page to e-mail, but does not send the information of input
?
Controller
public function store(Request $request) {
Mail::send('template.contato',
array (
'nome' => $request -> input('nome'),
'email' => $request -> input('email'),
'assunto' => $request -> input('assunto'),
'mensagem' => $request -> input('mensagem')
) , function($message) {
$message->from('meu email'); // para fazer teste por isso colocando meu email.
$message->to('meu email')->subject('Mensagem do site');
});
return response()->json(['status' => 1, 'msg' => 'Mensagem enviada']);
}
config/email.php
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => [
'address' => 'meu email',
'name' => 'Douglas',
],
'encryption' => 'ssl',
'username' => 'meu email',
'password' => 'minha senha',
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
Form:
{{ Form::open(['route' => 'contato.store']) }}
<div class="form-group">
{!! Form::label('Nome') !!}
{!! Form::text('nome', null, array(
'required',
'class' => 'form-control',
'id' => 'nome')) !!}
</div>
<div class="form-group">
{!! Form::label('Email') !!}
{!! Form::email('email', null, array(
'required',
'class' => 'form-control',
'id' => 'email')) !!}
</div>
<div class="form-group">
{!! Form::label('Assunto') !!}
{!! Form::text('assunto', null, array(
'required',
'class' => 'form-control',
'id' => 'assunto')) !!}
</div>
<div class="form-group">
{!! Form::label('Mensagem') !!}
{!! Form::textarea('mensagem', null, array(
'required',
'class' => 'form-control',
'id' => 'mensagem')) !!}
</div>
<div class="text-center">
<button type="submit"
class="btn btn-primary btn-lg">
Enviar
</button>
</div>
{!! Form::close() !!}
contact.blade.php
<div class="container">
<div class="row">
<div class="col-lg-6">
{{ Form::open(['route' => 'contato.store', 'method' => 'POST']) }}
<div class="form-group">
{!! Form::label('Nome') !!}
{!! Form::text('nome', null, array(
'required',
'class' => 'form-control',
'id' => 'nome')) !!}
</div>
<div class="form-group">
{!! Form::label('Email') !!}
{!! Form::email('email', null, array(
'required',
'class' => 'form-control',
'id' => 'email')) !!}
</div>
<div class="form-group">
{!! Form::label('Assunto') !!}
{!! Form::text('assunto', null, array(
'required',
'class' => 'form-control',
'id' => 'assunto')) !!}
</div>
<div class="form-group">
{!! Form::label('Mensagem') !!}
{!! Form::textarea('mensagem', null, array(
'required',
'class' => 'form-control',
'id' => 'mensagem')) !!}
</div>
<div class="text-center"><button type="submit" class="btn btn-primary btn-lg">Enviar</button></div>
{!! Form::close() !!}
</div>
<div class="col-lg-6">
<div class="recent">
<h3>Igreja Evangélica Semear</h3>
</div>
<div class="">
<h4>Endereço:</h4>Rua Três Marias, N° 219, Caruaru-PE.<br>
<h4>Telefone:</h4>(81) 99476-1916</br>
<h4>Cep:</h4>55032-250
<h4>Nosso E-mail:</h4>[email protected]
</div>
</div>
</div>
</div>
Cade the
template.contato
?– novic
I edited the question.
– Douglas William
Mail::send('template.contato',
you set up so then the page would betemplate.contato.blade.php
is missing her?– novic
I don’t know if it helps much... Know that Laravel has a component just for sending emails and is even very easy to use, already consulted the documentation? If not, see here: https://laravel.com/docs/5.2/mail#sending-mail
– Ramos