Laravel:如何在邮件中更改“收件人”字段?

Laravel:如何在邮件中更改“收件人”字段?

问题描述:

I found in the docs how to change the name of the sender but not where to specify the to field. I also did not find anything in the config/mail.php file.

When I send something to user Max Mustermann like this:

$user = \App\User::where('name','=','Mustermann')
                   ->where('vorname','=','Max')->first();
\Mail::to($user)->send(new Mail());

the mail will be send to

Mustermann < test@email.net >

but I want to send it to

Max Mustermann < test@email.net >

Where can I change this setting?

我在 docs 如何更改发件人的名称,而不是指定到 code>字段的位置。 我也没有在 config / mail.php code>文件中找到任何内容。 p>

当我发送内容给用户 Max Mustermann code>这样的时候 : p>

  $ user = \ App \ User :: where('name','=','Mustermann')
  - &gt; where('vorname','  =','Max') - &gt; first(); 
 \ Mail :: to($ user) - &gt; send(new Mail()); 
  code>  pre> 
 
  

邮件将被发送到 p>

  Mustermann&lt;  test@email.net&gt; 
  code>  pre> 
 
 

但我想将其发送到 p>

  Max Mustermann&lt;  test@email.net> 
  code>  pre> 
 
 

我在哪里可以更改此设置? p> div>

Mail::send('emails.welcome', ['key' => 'value'], function($message){
$message->to('foo@example.com', 'John Smith')->subject('Welcome!'); 
});

From the docs Laravel 5 docs