samedi 24 mars 2018

Laravel Mail Ignores my send from

So i'm trying to send a mail from a form using laravel, the email gets sent to the right address i specify, but the problem is, it ignores my message->from('$request->sender_email','Sender name') and always uses my gmail address as the sender I have echoed the sender_email and it exists. It also sends the correct Sender Name too

Heres my controller method

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');

}

Please help me spot anything i'm doing wrong



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GixYgj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire