Welcome Guest, Not a member yet? Register   Sign In
Email - from and Return-Path error
#6

[eluser]Chee Wai[/eluser]
[quote author="dee_smart" date="1197591493"]Is there a direct way to set the return-path? It always shows me a blank entry for return path in
$this->email->print_debugger(), I checked the code, the problem is with '<' as I have mentioned in my first post.[/quote]

Old topic, but for those who may be interested:
Likely you didn't see the addresses within the < and > because you are looking directly at the web page and the < > are treated as html tags, use the view source function of your browser.

Recently, i needed the Email class to support return paths for bounce handling
So I added this function to the Email class:
Code:
function return_path($returnpath)
    {
        if (preg_match( '/\<(.*)\>/', $returnpath, $match))
        {
            $returnpath = $match['1'];
        }

        if ($this->validate)
        {
            $this->validate_email($this->_str_to_array($returnpath));
        }

        $this->_set_header('Return-Path', '<'.$returnpath.'>');
    }

This will allow setting of return path, just ensure you call it after you call the "from" function so that it doesn't get overwritten.

In addition, the 3 lines for actual sending via mail/sendmail/smtp are admended to use Return path instead of From:
Code:
>> change
if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From'])))
>> to
if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['Return-Path'])))

>> change
$fp = @popen($this->mailpath . " -oi -f ".$this->clean_email($this->_headers['From'])." -t", 'w');
>> to
$fp = @popen($this->mailpath . " -oi -f ".$this->clean_email($this->_headers['Return-Path'])." -t", 'w');

>> change
$this->_send_command('from', $this->clean_email($this->_headers['From']));
>> to
$this->_send_command('from', $this->clean_email($this->_headers['Return-Path']));


Messages In This Thread
Email - from and Return-Path error - by El Forum - 12-10-2007, 04:38 PM
Email - from and Return-Path error - by El Forum - 12-10-2007, 06:02 PM
Email - from and Return-Path error - by El Forum - 12-13-2007, 11:16 AM
Email - from and Return-Path error - by El Forum - 12-13-2007, 11:31 AM
Email - from and Return-Path error - by El Forum - 12-13-2007, 12:18 PM
Email - from and Return-Path error - by El Forum - 11-02-2009, 12:54 PM
Email - from and Return-Path error - by El Forum - 11-02-2009, 02:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB