'Laravel - Swift_RfcComplianceException

Below is the error. However, if I put a static mail in the form of a string instead of that variable $mailTo, the mail works.

Address in mailbox given [] does not comply with RFC 2822, 3.6.2.

Controller

$mailTo = $request->input('mailAg');

Mail::send('mail.mail_ticket', $data, function ($message) use ($mailTo) {
    $message->from(Auth::user()->email, Auth::user()->name);
    $message->to($mailTo, $name = null);
    $message->subject('Nuovo Ticket');
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source