Laravel uses swiftmailer, which by default, encodes e-mail headers with Qp (quoted-printable) encoding. It works perfectly fine with most of e-mail clients, but there are some of them which seems that couldn’t implement correctly this encoding.
On these clients (for example, outlook connector for mdaemon or yahoo mail which i’m aware of), the space characters are missing in the subject.
In Qp encoding you can represent a space character with an underscore character. (see RFC 2047) Thats what these e-mail clients somehow did not implement correctly. Instead of showing a space character, they simply ignore the underscore character and print the subject without that part.
Fortunately, you can configure swiftmailer to use base64 encoding instead of Qp encoding in the headers, which is essentially solves the problem.
The best way to do it in Laravel, is to create a new MailServiceProvider class in the app folder and register it instead of laravel’s default MailServiceProvider. Then in your newly created MailServiceProvider class, you can simply override SwiftMailer’s default settings.
The MailServiceProvider class in the app folder:
It overrides the original MailServiceProvider’s registerSwiftMailer method, with a new one which configures SwiftMailer’s dependency injection to use the base64 header encoder class.
After this step, if you set the provider in the config/app.php file, your e-mail’s headers will be encoded as base64.
That will be solve this weird problem with these exotic e-mail clients. The space characters will be rendered correctly.