php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76771 Not be sent, by combination of mail-headers to be specified
Submitted: 2018-08-21 00:47 UTC Modified: 2018-08-27 09:48 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: ta_chi at nyc dot odn dot ne dot jp Assigned:
Status: Open Package: mbstring related
PHP Version: 5.6.37 OS: Windows
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ta_chi at nyc dot odn dot ne dot jp
New email:
PHP Version: OS:

 

 [2018-08-21 00:47 UTC] ta_chi at nyc dot odn dot ne dot jp
Description:
------------
In function 'mail()', a 'Warning' occurred depending on the combination of mail-headers to be specified, and not be sent.
But, if at least one is missing, it succeed.

That actual elements, please see the test script.

I know that "mb_send_mail()" does not support "quoted-printable".
However, I think that there is a discrepancy in behavior.


Emvironment
    Apache/2.4.27 (Win64) PHP/5.6.36, and, Apache/2.4.27 (Win64) PHP/7.0.30 
    Target MTA is IIS SMTP Service.



Test script:
---------------
<?php
error_reporting(E_ALL|E_STRICT);
ini_set("display_errors", "On");
echo mb_language('uni');

$sendto = "address@example.com";
$subject = "[Test]Subject";
$msg = "=E3=83=86=E3=82=B9=E3=83=88=E6=9C=AC=E6=96=87";

// If these elements combination exists in the code, an error will occur.
// But, even if at least one element is missing, it succeeds.
$headers = [
      "MIME-Version: 1.0"
    , "Content-Type: text/plain; charset=utf-8"
    , "Content-Transfer-Encoding: quoted-printable"
    , "" /* and empty string. */];
echo mail($sendto, $subject, $msg, implode("\r\n", $headers)) . "<br/>\n";
// -> "Warning: mb_send_mail(): Multiple or malformed newlines found in additional_header in xxx.php on line xx"

// Or, even if the newline-code is limited to LF, it will succeed.
echo mail($sendto, $subject, $msg, implode("\n", $headers)) . "<br/>\n";

Expected result:
----------------
Mail will be sent.


Actual result:
--------------
Mail was not sent.

An error occurred.
> "Warning: mb_send_mail(): Multiple or malformed newlines found in additional_header in xxx.php on line xx"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-21 04:24 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2018-08-21 04:24 UTC] requinix@php.net
PHP 7.0 is not in active support. Please try with 7.1 or later.


The headers cannot contain a \r\r or \n\r or \n\n, and it cannot end with a \r or \n.

> But, if at least one is missing, it succeed.
Example?
 [2018-08-21 07:08 UTC] ta_chi at nyc dot odn dot ne dot jp
-: xKouichi dot Tachi at vaio dot com +: ta_chi at nyc dot odn dot ne dot jp -Status: Feedback +Status: Open
 [2018-08-21 07:08 UTC] ta_chi at nyc dot odn dot ne dot jp
> PHP 7.0 is not in active support. Please try with 7.1 or later.

I checked it.
It was the same situation in 7.1.21 too.


> > But, if at least one is missing, it succeed.
> Example?

// fail
$headers = [
      "MIME-Version: 1.0"
    , "Content-Type: text/plain; charset=utf-8"
    , "Content-Transfer-Encoding: quoted-printable"
    , ""];

// success
$headers = [
      "Content-Type: text/plain; charset=utf-8"
    , "Content-Transfer-Encoding: quoted-printable"
    , ""];

// success
$headers = [
      "MIME-Version: 1.0"
    , "Content-Transfer-Encoding: quoted-printable"
    , ""];

// success, but, body text is garbled.
$headers = [
      "MIME-Version: 1.0"
    , "Content-Type: text/plain; charset=utf-8"
    , ""];

// success
$headers = [
      "MIME-Version: 1.0"
    , "Content-Type: text/plain; charset=utf-8"
    , "Content-Transfer-Encoding: quoted-printable"];
 [2018-08-21 08:34 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2018-08-21 08:34 UTC] requinix@php.net
Is it possible you have an extra comma somewhere in $headers?
 [2018-08-23 07:35 UTC] ta_chi at nyc dot odn dot ne dot jp
-Status: Feedback +Status: Open
 [2018-08-23 07:35 UTC] ta_chi at nyc dot odn dot ne dot jp
No, there is no extra comma.
 [2018-08-23 15:17 UTC] cmb@php.net
As the reported warning shows, you are using the MBString function
overload “feature” (which is deprecated as of PHP 7.2.0, by the
way).  I can reproduce the reported warning, if I add:

  mb_language('Japanese');

However, I also get:

  Warning: mb_send_mail(): Unsupported transfer encoding "quoted-printable" - will be regarded as 8bit in %s
 [2018-08-27 09:48 UTC] cmb@php.net
-Package: Mail related +Package: mbstring related
 [2024-03-09 11:07 UTC] wallacewebster dot 60 at gmail dot com
Any update? (https://github.com)(https://www.lasrslogin.online/)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 01:01:27 2024 UTC