php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65680 imap_headerinfo: Value of reply_toaddress when reply-to is empty in mail header
Submitted: 2013-09-16 14:06 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: walter at x5 dot nu Assigned:
Status: Open Package: IMAP related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-09-16 14:06 UTC] walter at x5 dot nu
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.7050108@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.7050108@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

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 20:01:28 2019 UTC