3

Recently, one of my collegue started having issues sending mail from different hosts where we were developping sites. He then remembered a long time ago that using the 5th parameter, he can pass a "-f email" in the mail() call such as:

mail('mdumoulin@mydomain.com', 'test', 'test', '', '-f mdumoulin@mydomain.com');

I'm really wondering WHY does he have to do this and what is the cause of my mail not going out when i don't use this flag.

Note that the same thing just occured again on the development server i was building, if i didn't put that 5th param, the mail were getting lost in space and never sent.


UPDATE

How can i manage to configure postfix/php to prevent me from having to use this configuration. I've been programming PHP for 11 years and i only recently started to have to do this. There must be a way to prevent this from hapenning...

Mathieu Dumoulin
  • 12,126
  • 7
  • 43
  • 71
  • In the `additional_headers` parameter to `mail()`, are you specifying a `From` header? What does the `sendmail_path` entry in php.ini show? Can you check your Postfix `main.cf` file and look for any entries like `smtp_generic_maps, canonical_maps, or alias_maps` and see if any map files are set up? There are many other controls that can rewrite from addresses but those are common. – drew010 Nov 30 '11 at 22:08

1 Answers1

2

Seems like you have to be a trusted user on the sending server to send mail from it. Of what I've read in my research, -f just confirms that your user is a trusted user.

http://www.php.net/manual/en/function.mail.php Research -f in this page, you fall right on it.

What makes your mail doesn't go out would be that the server, not recognizing a trusted user, adds the X-Warning Header.

Fredy31
  • 2,660
  • 6
  • 29
  • 54