Help us understand the problem. What is going on with this article?

Laravel5.8 メールの件名(From)が文字化けしてしまう時の対処法

ユーザ向けの自動返信メールのFrom(送信者情報)を変えたところ文字化けしてしまったので自分用メモ

app/Mail/Mail.php
<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class Contact extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($mail)
    {
        // Fromメールアドレス
        $this->mail = $mail;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        // mb_encode_mimeheader()でFromをエンコードする
        return $this->from($this->mail, mb_encode_mimeheader('〇〇運営事務局'))
        ->subject('HPからのお問い合わせありがとうございます。')
        ->text('mails/contact');
    }
}

ぶっちゃけLaravelはそんなに関係ないメールあるあるだけど、迷える子羊のために(自分)残しておく

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away