Welcome Guest, Not a member yet? Register   Sign In
Email Class return path
#1

[eluser]stef25[/eluser]
My CI app is sending out emails to users, which is all going fine. However, in Hotmail the FROM appears as "www-data ([email protected]) on behalf of MySiteName ([email protected])"

The only thing that should be shown here is "MySiteName ([email protected])", as is the case in gmail and yahoo. The rest reveals information about the server that is sending the mails.

When I look at the "full view" of the received email in gmail (not the normal inbox view which is fine), I see

- Return-Path: <[email protected]>
- Sender: www-data <[email protected]>

"domain" in this case is the company that's hosting the site for us and this data should not be displayed as it is in Hotmail.

In my model I have

Code:
$config['mailtype'] = "html";
        
        $msg = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                &lt;html &gt;
                &lt;head&gt;&lt;/head>&lt;body&gt;';
        $msg .= "bla ";
        $msg .= "&lt;/body&gt;&lt;/html>";
        
        $this->load->library('email');
        $this->email->initialize($config);        
        $this->email->from('[email protected]', 'Site');
        $this->email->reply_to('[email protected]', 'Site');
        $this->email->to('[email protected]');
        $this->email->subject('An Order was made');
        $this->email->message($msg);        
        $this->email->send();

Does anyone know how I can set or remove the "“www-data ([email protected]) on behalf of MySiteName ([email protected])" string?

In the CI Email Class I see

Code:
$this->_set_header('Return-Path', '<'.$from.'>');

but afaik $from should never contain that external-domain.com string? Is this something that needs to be set in the email config of the server?
#2

[eluser]bretticus[/eluser]
Try setting additional parameters. Specifically the -f switch to force your own return path.

Code:
$config['mailpath'] = '/usr/sbin/sendmail [email protected]';

Untested and not guaranteed to work. But give it a try at least.

In the native PHP mail() function, you would set this in the 5th optional parameter for that function. You can also set it globally in your php.ini (or using php_flag from htaccess file) with:

Code:
mail.force_extra_parameters = "[email protected]"

Good luck!
#3

[eluser]sophistry[/eluser]
this thread about return-path handling in CI could help: http://ellislab.com/forums/viewthread/122352/




Theme © iAndrew 2016 - Forum software by © MyBB