所以我正在尝试使用laravel从表单发送邮件,电子邮件将被发送到我指定的正确地址,但问题是,它忽略了我的message->from('$request->sender_email','Sender name')
并始终使用我的gmail地址作为寄件人
我已经回应了sender_email并且它存在。
它也会发送正确的发件人名称
继承我的控制器方法
public function insert_sendmail(Request $request)
{
$this->validate($request,
[
'sender_email' => 'required',
'receiver_email' => 'required',
'receiver_name' => 'required',
'message' => 'required'
]);
$data = array('name'=>"$request->message");
// dd($request);
Mail::send(['text'=>'mail'], $data, function($message) use($request)
{
$message->to($request->receiver_email, $request->receiver_name)->subject('Basic Email Notification Testing Mail');
$message->from("$request->sender_email",'Admin');
});
return redirect()->route('settings.index')->with('info', 'Email Sent');
}
请帮我看看我做错了什么