从Email Friend Form发送邮件时出现此错误。我正在使用mailtrap.io来测试邮件,我已经配置了.env文件...请帮忙告诉我哪里错了...
错误: 给定[* myname]的邮箱中的地址不符合RFC 2822,3.6.2。
与朋友表格分享.....
这是我的sendmail功能......
public function sendcadmodelMail(Request $request) {
$this->validate($request, array(
'yourname' => 'Required',
'friendemail' => 'Required|Email',
'subject' => 'Required',
'messagetext' => 'Required'
));
$data = array(
'yourname' => $request->yourname,
'friendemail' => $request->friendemail,
'subject' => $request->subject,
'messagetext' => $request->messagetext,
);
Mail::send('cadmodels.mailtemplate', $data, function($message) use ($data) {
$message->from($data['yourname']);
$message->to($data['friendemail']);
$message->subject($data['subject']);
});
Session::put('flash_message', 'Email Sent....!!');
return redirect()->back();
}
这是我的laravel表格......
{!! Form::open(['url' => route('cadmodels.share'),'class'=>'form-horizontal','method'=>'POST']) !!}
{{ csrf_field() }}
<div class="form-inputs">
<div class="form-group">
{{ Form::label('yourname', 'Your Name') }}
{{ Form::text('yourname' ,null, ['class' => 'form-control','id'=>'yourname','required' => 'required']) }}
</div>
<div class="form-group">
{{ Form::label('friendemail', 'Friend Email') }}
{{ Form::email('friendemail' ,null, ['class' => 'form-control','id'=>'friendemail','required' => 'required']) }}
</div>
<div class="form-group">
{{ Form::label('subject', 'Subject') }}
{{ Form::text('subject' ,null, ['class' => 'form-control','id'=>'subject','required' => 'required']) }}
</div>
<div class="form-group">
{{ Form::label('messagetext', 'Message') }}
{{ Form::textarea('messagetext' ,null, ['class' => 'form-control' ,'id'=>'messagetext','rows'=>'6']) }}
</div>
</div>
<div class="form-submit">
<input type="submit" class="btn btn-primary btnsubmit" value="Send">
</div>
{!! Form::close() !!}