Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my postfix log I have the following when I send e-mail from a PHP based web site:

Feb 11 11:52:04 cp5 postfix/qmgr[6007]: 93C6E79C4D1: from=||, size=3266, nrcpt=1 (queue active)

(I substituted | for smaller-than / greater-than signs.)

The problem with the above is that I need to control the "FROM:" address. I know I can control the "" address by modifying the "mydomain" in Postfix file and I had to do that in order to stop e-mail from bouncing in the first place. The problems is now people are reply to "" and I don't want that.

This is a Plesk 9.5 server which as far as I know runs a stock standard Postfix installation. I would like advice on how to fix this problem in my PHP script.

share|improve this question

This is something you can do from your PHP script:

Have a look at Examaple #2 here:

$to      = '';
$subject = 'the subject';
$message = 'hello';
$headers = 'From:' . "\r\n" .
    'Reply-To:' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

This example also gives you control over the Reply-To headers. There's no need to touch anything in Postfix!

share|improve this answer

Use -f option(sender address):

mail('', 'the subject', 'the message', null,
share|improve this answer
+1 Adding "-f" to the mail() function in PHP is easier then writing out all your headers by hand. – Coops Feb 11 '11 at 13:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.