From:             walter at x5 dot nu
Operating system: Linux
PHP version:      Irrelevant
Package:          IMAP related
Bug Type:         Feature/Change Request
Bug description:imap_headerinfo: Value of reply_toaddress when reply-to is 
empty in mail header

Description:
------------
PHP5.3.3-7
Debian 6.0

If the email header does not contain a reply-to field, then the function
imap_headerinfo() returns the value of the email header field 'Return-Path'
instead of an empty string in the field [reply_toaddress]

Example:
This is the relevant header info of the mail in the inbox

>From x...@example.com  Mon Sep 16 15:42:06 2013
Return-Path: <x...@example.com>
X-Original-To: y...@example.com
Delivered-To: y...@example.com
X-IMP-FROM: _________<x...@example.com>
X-IMP-AUTH_USERNAME: <x...@example.com>
X-Original-IP: 12.34.56.78
Message-ID: <52370aa4.7050...@example.com>
Date: Mon, 16 Sep 2013 15:41:56 +0200
From: x <x...@example.com>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803
Thunderbird/17.0.8
MIME-Version: 1.0
To: y...@example.com
Subject: Test
X-Enigmail-Version: 1.4.6
Content-Type: multipart/mixed;
 boundary="------------020508080209090708030903"

This is a multi-part message in MIME format.
--------------020508080209090708030903
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
...

Using the PHP function
$headerInfo = imap_headerinfo($mbox, $overview->msgno);
print_r($headerInfo);

results in:

stdClass Object
(
    [date] => Mon, 16 Sep 2013 15:41:56 +0200
    [Date] => Mon, 16 Sep 2013 15:41:56 +0200
    [subject] => Test
    [Subject] => Test
    [message_id] => <52370aa4.7050...@example.com>
    [toaddress] => y...@example.com
    [to] => Array
        (
            [0] => stdClass Object
                (
                    [mailbox] => y
                    [host] => example.com
                )

        )

    [fromaddress] => x <x...@example.com>
    [from] => Array
        (
            [0] => stdClass Object
                (
                    [personal] => x
                    [mailbox] => x
                    [host] => example.com
                )

        )

    [reply_toaddress] => x <x...@example.com>
    [reply_to] => Array
        (
            [0] => stdClass Object
                (
                    [personal] => x
                    [mailbox] => x
                    [host] => example.com
                )

        )

    [senderaddress] => x <x...@example.com>
    [sender] => Array
        (
            [0] => stdClass Object
                (
                    [personal] => x
                    [mailbox] => x
                    [host] => example.com
                )

        )

    [Recent] => N
    [Unseen] =>  
    [Flagged] =>  
    [Answered] =>  
    [Deleted] =>  
    [Draft] =>  
    [Msgno] =>    1
    [MailDate] => 16-Sep-2013 15:41:56 +0200
    [Size] => 24400
    [udate] => 1379338916
)

Test script:
---------------
Sent an email without reply to header to target server
On target server used:
$headerInfo = imap_headerinfo($mbox, $overview->msgno);
print_r($headerInfo);

As a result
$headerInfo->reply_toaddress is not empty, but contains value of
'Return-Path' from email header


Expected result:
----------------
In the above example I would expect an empty string in
$headerInfo->reply_toaddress

Actual result:
--------------
$headerInfo->reply_toaddress contains the value of 'Return-Path' from the
email header

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65680&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65680&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65680&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65680&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65680&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65680&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65680&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65680&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65680&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65680&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65680&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65680&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65680&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65680&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65680&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65680&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65680&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65680&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65680&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65680&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65680&r=mysqlcfg

Reply via email to