This repository was archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
Subject header is duplicated #22
Labels
Comments
Closed
I was not able to reproduce this error. It seems, it is fixed in the current version. Successfully tested on Windows 10 Pro with php-7.1.26-Win32-VC14-x64, php-7.2.15-Win32-VC15-x64 and php-7.3.2-Win32-VC15-x64. Used quickstart example for Sendmail Transport Usage use Zend\Mail\Message;
use Zend\Mail\Transport\Sendmail as SendmailTransport;
$message = new Message();
$message->addTo('matthew@example.org');
$message->addFrom('ralph@example.org');
$message->setSubject('Greetings and Salutations!');
$message->setBody("Sorry, I'm going to be late today!");
$transport = new SendmailTransport();
$transport->send($message); Received mail
Edit: zend-mail v2.10.0 |
But why is And for clarity include the value of your current zend-mail version. |
Very good observation, I will have a look into it. This might be a new issue. |
This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at laminas/laminas-mail#72. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Summary
On Windows with PHP 7, when sending an mail message with the Sendmail transport, the subject header is duplicated.
Steps to reproduce
To reproduce the bug the sample from here can be used:
http://framework.zend.com/manual/current/en/modules/zend.mail.introduction.html
The resulting mail headers look something like this:
Subject: Test Subject
Date: Wed, 29 Jul 2015 17:33:17 +0000
From: =?UTF-8?Q?test?= test@test.com
To: test@test.com
Subject: Test Subject
Cause
In the Sendmail transport all headers (including the Subject) and the subject itself are passed to the php mail function:
$result = mail($to, $subject, $message, $headers);
The mail function then appends to the $subject to the $headers. I do not think the php mail function should handle this case because it doesn't know what subject the caller intended to use. However I believe php mail should at least issue a warning (TBD: file enhancement at https://bugs.php.net/).
Solution
Pass the headers without the Subject header to the php mail function. This is already done if the os is not Windows in the prepareHeaders. I think it should be done for Windows as well.
The text was updated successfully, but these errors were encountered: