# Can't send emails with -f option only from php running under apache



## cbichis (Jul 14, 2010)

Hi,

I am having installed sendmail 8.14.4 on a 8.1 BSD machine.

I am having problems sending emails from php due to -f option.

Here is a sample PHP code:

```
$to      = 'receiver@test.com';
$subject = 'the subject';
$message = 'mesaj de test';
$headers = 'From: [email]sender@test1.com[/email]' . "\r\n" .
    'Reply-To: [email]sender@test1.com[/email]' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

        $result = mail($to, $subject, $message, $headers, '-f [email]sender@test1.com[/email]');
        var_dump($result);
        ?>
```

If i send from cli (php test.php) all is working fine. If i am trying to send by calling the php page (http://www.test1.com/test.php) i am getting a "false" return for the mail() function.

If i try to send without '-f sender@test1.com' all is working properly in all cases.

Any idea what could be the problem ?


----------

