mardi 2 octobre 2018

Larvel sendmail driver not works. Malformed UTF-8 characters, possibly incorrectly encoded

laravel sendmail driver not works. gives me this error Malformed UTF-8 characters, possibly incorrectly encoded. (full error list you can see here https://pastecode.xyz/view/f28c82a3).

If I use log driver then will be all ok.

class MailController   extends Controller{
    public function send()
    {
        $objDemo = new \stdClass();
        $objDemo->demo_one = 'Demo One Value';
        $objDemo->demo_two = 'Demo Two Value';
        $objDemo->sender = 'SenderUserName';
        $objDemo->receiver = 'ReceiverUserName';

        Mail::to("receiver@example.com")->send(new DemoEmail($objDemo));
    }
}

class DemoEmail

class DemoEmail extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * The demo object instance.
     *
     * @var Demo
     */
    public $demo;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($demo)
    {
        $this->demo = $demo;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from('sender@example.com')
                    ->view('mails.demo')

                    ->with(
                        [
                            'testVarOne' => '1',
                            'testVarTwo' => '2',
                        ])
                    ;
    }
}

Blade text

Hello <i></i>,
<p>This is a demo email for testing purposes! Also, it's the HTML version.</p>

<p><u>Demo object values:</u></p>

<div>
    <p><b>Demo One:</b>&nbsp;</p>
    <p><b>Demo Two:</b>&nbsp;</p>
</div>

<p><u>Values passed by With method:</u></p>

<div>
    <p><b>testVarOne:</b>&nbsp;</p>
    <p><b>testVarTwo:</b>&nbsp;</p>
</div>

Thank You,
<br/>
<i></i>

all files are in UTF-8 encoding, how to fix this? default php function mail() works well

laravel 5.6



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire