[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']));