In simple words, php mail documentation asks to use \r\n in the headers for php mail() as the standard.
But if the server using qmail, then it has to be \n, because qmail auto covert \n to \r\n.
I have hundreds php mail() codes written with headers \r\n according to php documentation. Now I am having problems with them because I am qmail now.
So I am thinking a quick solution. Because every mail out codes, I started with
"$mailresults =" and all the headers I first put them in $headers and then pass $headers to the mail(),
So here is my solution
1) search all the files with "$mailresults" display that line and path to that file. I will double check to see if they are all my codes etc to be on the safe side. Due to I only host my codes, and I use very few 3rd party php systems, most of them or not all should be my own codes.
find /www -exec grep "$mailresults" '{}' \; -print
The above Unix command only display the path, right? I want Unix command also display the full line text that has "$mailresults" in it too. If the file has multiple "$mailresults", I want to display them all.
2) second, I want Unix command search all the files with "$mailresults", and change it to 4 lines codes,
newline
$headers=str_replace("\r\n", "\n", $headers);
newline
$mailresults........................
This way, if in the future, I need the headers to be \r\n again, I just need to comments out this line
$headers=str_replace("\r\n", "\n", $headers);
vice versa.
Thanks!