i was trying to send an email and when i want to whrite the email address of the destination (the email is a parameter of the function), i have this error. Can someone help me.
this is my function:
public function email($name, $email2) {
  $data = array('name'=> $name);
  Mail::send('mail',$data,function($message) {
    $message->to($email2, $name)->subject('Deposit Confirmation');
    $message->attach(public_path('document.pdf'));
    $message->from('xxx@xxx.pt', 'XXX');
  });
}
this is my error: "Undefined variable email2"
thank you
 
    