I have below code using codeigniter,
$config['mailtype'] ='html';
$config['charset'] = 'iso-8859-1';
$config['protocol'] ='smtp';
$config['smtp_host'] ='mail.DomainName';
$config['smtp_user'] = "UserEmailId";
$config['smtp_pass'] = "UserPassword";
$config['smtp_port'] ='25';
$this->email->clear(TRUE);
$this->email->initialize($config);
$this->email->from($fromemail, $fromname);
$this->email->to( $email_to );
$this->email->return_path("BouceEmailId"); // I have made this function in system/library/email.php. Also changed the mail() -f field from _headers['from'] to _headers['return-path']
$this->email->subject( "Subject" );
$this->email->message( "This is test email" );
$this->email->send();
In above code it sent an email. But it removes the return path that I have set and it just replace it with the from address. I have read some articles that says SMTP sets return path when it delivers.
How can I set Return Path when I use SMTP authentication?
SMTP not allowed to set custom return_path for bounced emails. It automatically sets return_path with from address when delivered.