title: Accessing email from MySQL db to be use for sending email
body: <p>I have a problem with my message notification using email.Why is that it generates an error inside the foreach.
  The error is this part "$all_ngo" Undefined variable: all_ngo.</p>
  
  <pre><code>$pend = AddRequest::where('ship_id','=',$ship_id)-&gt;get();   
  $all_ngo = [];
  foreach ($pend as $id) {
      array_push($all_ngo, $id-&gt;ngo_id);
  }
  
  $orga_email  =  Auth::User()-&gt;orgainfo-&gt;orga_email;
  $staffName  =   Auth::User()-&gt;orgainfo-&gt;inchargelname.' '. Auth::User()-&gt;orgainfo-&gt;inchargefname;  
  $name = $scholars-&gt;scholar_fname.' '.$scholars-&gt;scholar_mname.' '.$scholars-&gt;scholar_lname;
  $input =  array(
      'name' =&gt; $staffName,
      'email' =&gt; $orga_email,  
      'msgs' =&gt; 'asd' .' '. $name.'. '.'Hoping for your favorable response. Thank you!'
  );
  Mail::send('emails.mailMessage', $input,  function($message){
      $message-&gt;from('Somename@gmail.com');
      foreach ($all_ngo as $id3) {&lt;-------Undefined variable: all_ngo
          $user = User::find($id3);
          $ngo_email2 = $user-&gt;ngo_email;
          $message-&gt;to($ngo_email2)-&gt;subject('Request For Sponsorship');
      }   
  });
  </code></pre>