[php-maint] Bug#447074: php5: Function mail strips "\n" from subject

Oliver Jusinger juol at bergfex.at
Wed Oct 17 20:51:51 UTC 2007

Package: php5
Version: 5.2.0-8+etch7
Severity: normal

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (1000, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18bergfex070821
Locale: LANG=de_AT at euro, LC_CTYPE=de_AT at euro (charmap=ISO-8859-15)

Versions of packages php5 depends on:
ii  libapache2-mod-php5        5.2.0-8+etch7 server-side, HTML-embedded scripti
ii  php5-common                5.2.0-8+etch7 Common files for packages built fr

php5 recommends no packages.

-- no debconf information

The manual of function mail() says the subject must not contain newline
characters, however they are required to fold long header fields according
to RFC2822 2.2.3., so most mailing sripts like PEAR::Mail_Mime insert linefeeds
into long subjects.

Linefeed in subjects are working fine in PHP 4.4.4-8+etch4 and PHP
5.2.4-1+b1 (sid), however in the stable version PHP 5.2.0-8+etch7 "\n" is
removed from the subject. "\r\n" works, however postfix requires "\n".


$subject = "=?ISO-8859-1?Q?Bugreport_Debian_PHP_5.2.0-8+etch7_=F6=FC=E4_(sp?=\n =?ISO-8859-1?Q?ecial_Characters)?=";
$to = 'some at email.xyz';
$body = 'some text';
$header = 'From: my at email.xyz';
mail($to, $subject, $body, $header);

It would be nice if "\n" in subjects is accepted by the mail function in the stable
version of PHP, too.

More information about the pkg-php-maint mailing list