Sendmail and Mail from PHP

While working on signing PHPs outgoing mail with a DKIM signature that Yahoo now considers a necessity if you want your email to arrive at the inbox, i came across a problem.

Whenever i add the fifth parameter to the mail function, -f mail@domain.com to change the default envelope sender, PHP mail returns a false meaning mail was not sent

After trying to change the sendmail line in php.ini to remove the -i then removed the -t then removed both, then checked the lists such as /etc/mail/trusted-users and so forth but with no change, i wrote a wrapper around sendmail to log what is coming in and what is going out, and to my surprise, it is not sendmail that says NAY, nothing is arriving at the wrapper when the fifth param is added, so it seems the problem is PHP itself and not sendmail

Simply turning off SAFE MODE resolved the issue, and here i am trying to spare you the need to look everywhere when the answer was something i should have checked before i start.

catching spammers

So, it is not only that i hate spammers, they also hurt us.

If a client we have is a spammer, the mail servers could get “Banned” at major email providers including Hotmail, Gmail, Yahoo, etc… and we can not afford legitimate client mail delivered to Spam folders or blocked all together

We do have measures to limit the amount of email sent per domain, But an in depth analysis of the mail is also important.

So at the office, i setup an UBUNTU linux machine and installed ISOQMAIL, ./configure make then make install

On the server, i made a job to copy the mail log (/usr/local/psa/var/log/maillog) to a password protected, web accessible directory, On the local machine i made a script to fetch the files into a directory known to isoqlog.

So now i need to make 2 files, one with the domains and one with the config, the file locations of the logs isoqlog should expect to find logs in and the place it should output the data to !

As for catching the PHP scripts that actually send the mail, here is a trick… PHP sends through sendmail, and we can actually have an intermediate script that verifies the mail, Limits it, or does anything else that is needed before actually sending the mail.

1- Add a wrapper script file (/var/qmail/bin/mailwrap), this can be a PHP script if you like to eecute at command line, A copy should go to the actual mail script, the other to wherever you want to log or control activity !