Address in mailbox given [] does not comply with RFC 2822, 3.6.2. when email is in a variable

后端 未结 13 2233
执笔经年
执笔经年 2020-12-16 09:52

I have a correct email address. I have echoed it, but when I send it, I get the following error:

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


        
13条回答
  •  -上瘾入骨i
    2020-12-16 10:32

    Data variables ($email, $subject) seems to be global. And globals cannot be read inside functions. You must pass them as parameters (the recommended way) or declare them as global.

    Try this way:

    Mail::send('emails.activation', $data, function($message, $email, $subject){
            $message->to($email)->subject($subject);
        });
                ->with('title', "Registered Successfully.");
    

提交回复
热议问题