Answer the question
In order to leave comments, you need to log in
Why is the sender's encoding wrong?
there is a constant in laravel .env file
When sending mailMAIL_FROM_NAME="Имя_отправителя_русскими_буквами"
Mail::send('emails.test', $data['content'], function($message) use ($data)
{
$message->from(env('MAIL_FROM_ADDRESS'), env('MAIL_FROM_NAME'));
$message->to($data['to']);
$message->subject($data['subject']);
});
Answer the question
In order to leave comments, you need to log in
Non-Latin characters in from must be encoded in base64, specifying the encoding
For example, an email from Toster about your question has the title
moreover, if the letter is saved to a file and opened in a text editor, then this header looks like
From: =?utf-8?B?0KLQvtGB0YLQtdGAIOKAkyDQstC+0L/RgNC+0YHRiyDQuCDQvtGC0LLQtdGC?=
=?utf-8?B?0Ys=?= <[email protected]>
"Имя_отправителя_русскими_буквами"
directly in the .env file like this , $message->from()
(seems to use base64).
I always write like this
Mail::send('email.users', function ($message) use ($email) {
$message->from(env('MAIL_ADMIN', env('MAIL_FROM_NAME')), 'Спасибо за заказ');
$message->to($email, 'Сообщение о заказе')->subject('Сообщение о заказе');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question