Open nilshellerhoff opened 1 year ago
I have the same problem with subjects containing a semicolon. The subject content is removed after the semicolon.
Sample:
Subject: This is an example; for example
Results in:
echo $message->subject;
This is an example
The problem originates here:
Im not very versed in email handling, but when reading this (altough not an authoritative source ofcourse) it seems to me, that certain fields including subject ... should maybe be excluded from extension parsing, and additionally to checking for semicolons, the parser should actually only parse a field, if it finds a key=value pair after the semicolon.
Can you maybe comment on this @Webklex? I can also do a PR otherwise in the weekend.
I have the same problem with subjects containing a semicolon. The subject content is removed after the semicolon.
Subject : Test; ticket <
Describe the bug When parsing the header of an email where the from field contains a semicolon ";", the from field will not be parsed correctly. Minimal example of such an email:
The raw email is appended to avoid issues with linebreaks (I changed the extension to
.txt
as Github doesn't support.eml
). semicolon_test.txtUsed config Default.
Code to Reproduce
Output when running this via
php test.php
:Expected behavior When we remove the semicolon from the from-header, we get the expected result:
Screenshots If applicable, add screenshots to help explain your problem.
Desktop / Server (please complete the following information):
OS: Linux Mint 21 (= Ubuntu 22.04)
PHP: 7.4 and 8.1
Version 4.0.2
Provider: The mail which triggered the issue was sent through the "Contact Form 7" plugin on a Wordpress instance.
EDIT: I am not actually sure that a semicolon in the header fields confroms to the spec, but Gmail, Thunderbird and also phpmailer do handle these mails correctly.