htmlentities() expects parameter 1 to be string, object given

The problem is in PagesController inside the Mail::send.

'message' => $request->get('message');

You are using the variable name 'message' and it should be avoided.

Note: A $message variable is always passed to e-mail views, and allows
the inline embedding of attachments. So, it is best to avoid passing a
message variable in your view payload.

source: http://laravel.com/docs/5.0/mail#basic-usage in the first note.

You might need to change the variable name to be something else.

'bodyMessage' => $request->get('message');

And don’t forget the change the variable name in your contact.blade.php as well

<p>
Name: {{ $name }}
</p>

<p>
{{ $email }}
</p>

<p>
{{ $phone }}
</p>

<p>
{{ $bodyMessage }} // This line.
</p>

Leave a Comment