Skip to content

Laminas\Mail\Storage\Message fails with non utf8 characters #234

Description

@arunvarghe

Bug Report

When I try to run the below code
new Laminas\Mail\Storage\Message(['file' => DIR . '/../fixtures/emails/email_with_non_utf8_subject.eml'])

The file has subject with non-utf8 characters
For example:
Subject: This is AUTOABUSE. PLEASE STOP 178.162.214.194 spam defiling your email system or hosting. THANKU for compliance: ������� �������������� - �� 750 ���.

It gives the following exception back!!
Laminas\Mail\Header\Exception\InvalidArgumentException: Invalid header value detected

Summary

Current behavior

The file has subject with non-utf8 characters
For example:
Subject: This is AUTOABUSE. PLEASE STOP 178.162.214.194 spam defiling your mail system or hosting. THANKU for compliance: ������� �������������� - �� 750 ���.

It gives the following exception back!!
Laminas\Mail\Header\Exception\InvalidArgumentException: Invalid header value detected

How to reproduce

Try this
new Laminas\Mail\Storage\Message(['file' => DIR . '/../fixtures/emails/email_with_non_utf8_subject.eml'])''

and File should have the following content
Subject: This is AUTOABUSE. PLEASE STOP 178.162.214.194 spam defiling your mail system or hosting. THANKU for compliance: ������� �������������� - �� 750 ���.

Expected behavior

It fails with the latest version. I was able to create a message object earlier. I get InvalidArgumentException now. I should be able to create a message object with non-utf8 characters without any error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions