这个问题似乎很容易,尽管我认为我所做的一切都正确。使用Laravel 5.5
在我的电子邮件表格中,我检查电子邮件的填写人:
<div class="o-grid__col u-12/12@sm">
{!! Form::label('contact_e_mail', __('profile.contactEmail').'*') !!}
{!! Form::text('contact_e_mail', null, ['placeholder' => __('profile.contactEmail'),'class' => 'c-input required email','id' => 'contact_e_mail','required']) !!}
</div>
在我的控制器中,我检查了use()中的邮件:
public function send_mail(Request $request,VendorProfile $profile_id){
$profile= $profile_id;
$email = $request->input('contact_e_mail');
$contact_first_name = $request->input('contact_first_name');
$email_profile = $profile->email;
$name_profile = $profile->name;
Mail::send('mail.contact-provider-confirmation', ['profile' => $profile,'request' => $request], function ($message) use ($email,$contact_first_name) {
$message->from(env('MAIL_ADMIN_ADDRESS'), 'Abouthorses.com');
$message->to($email, $contact_first_name)->subject(\Lang::get('mail.contactSubjectConfirmation'));
});
Mail::send('mail.contact-provider', ['profile' => $profile,'request' => $request], function ($m) use ($email_profile, $name_profile) {
$m->from(env('MAIL_ADMIN_ADDRESS'), 'Abouthorses.com');
$m->to($email_profile, $name_profile)->subject(\Lang::get('mail.contactSubject'));
});
return redirect()->route('vendor.show',$profile->id);
}
当我输入有效的电子邮件时,电子邮件已正确发送