title: Laravel - Mail::send() How to pass data (in array format) to email html and send it
body: <p>I am trying to pass the value from the request, which is stored as an array, to an email in html format before sending.</p>
  
  <pre><code>$data = array('email' =&gt; $request-&gt;get('email'), 'name' =&gt; $request-&gt;get('name'));
      Mail::send('emails.email', ['data' =&gt; $data], function ($message) use ($data) {
          $message-&gt;subject('Hello world!');
          $message-&gt;to($data['email'], $data['name']);
      });
  </code></pre>
  
  <p>This is my email html format file in <strong><em>email.blade.php</em></strong></p>
  
  <pre><code>&lt;h2&gt;HELLO YOU HAVE A NEW EVENT!&lt;/h2&gt;
  &lt;h3&gt;TO {{$name}}&lt;/h3&gt;
  &lt;h4&gt;See more details .... &lt;a href="http://localhost:8000/event" target="_blank"&gt;Events&lt;/a&gt;&lt;/h4&gt;
  </code></pre>
  
  <p>But it appears that the html file does not receive the variable ($name) that was sent</p>
  
  <p>How to pass data (in array format) to email html?</p>
  
  <p>I tried sending without the $ name variable. It appears that there is no problem. Everything goes smoothly But I really need to use variables Please help me</p>
  
  <p>I can use $name if use this code</p>
  
  <pre><code>$data['name'] = "Guest";
      Mail::send('emails.email', $data, function ($message) {
          $message-&gt;to('email@gmail.com', 'name')
                  -&gt;subject('topic');
      });
  </code></pre>
  
  <p>Why?</p>