Hello,

I am trying to create a space between line yet it does not work. It suppose to go to the next line. Instead of printing space it actually prints the html tag <br>. Any clue how to fix this problem?

$content = "Someone purchase your picture".<br><br>;

foreach ($request->input('pic') as $key => $value) {

    $content .= "$key : $value".<br>;

    }
Member Avatar for diafol

Include the tags within the quotes. No need to try and concatenate.

$content = "Someone purchase your picture<br><br>";
Member Avatar for diafol

I would suggest using css though. Multiple breaks are generally a bad idea.

I actually email the result and it actually shows the html code insteading of really spacing.

SettingController.php

   public function SendPicture(Request $request)
   {

    $title = "Picture Purchase";
    //$picture = $request->input('pic');

    $content = "Someone purchase your picture<br><br>";

    foreach ($request->input('pic') as $key => $value) {

        $content .= "$value".".jpg <br>";

        }

    Mail::send('soulfy.email.purchase', ['title' => $title, 'content' => $content], function ($message) //use ($attach)
    {

        $message->from('davy.yg1@gmail.com', 'Admin');

        $message->to(['davy_yg@yahoo.com', 'stokfoto@soulfy.com']);

        //Attach file
        //$message->attach($attach);

        //Add a subject
        $message->subject("Picture Purchase");

    });

    return redirect('home/setting');

}

Result: Picture Purchase

Someone purchase your picture<br><br>Music2.jpg <br>Travel.jpg <br>Basket.jpg <br>

email/purchase.blade.php

{{$title}}

<br><br>

{{$content}}
Member Avatar for diafol

You never mentioned a templating engine. Nor email. If sending email via template - the whole point is that you don't include any markup from your model or controller and it all gets created on the fly in the view.

Have a look at this. You can send plain text email or just default html:

https://laravel.com/docs/5.4/mail

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.