Thursday, February 17, 2011

Mail in PhP

I have started and stopped working with PhP several times. Security and mail were my reasons. Today I actually got the sample code for w3schools working. In particular, the code with the form in it with the action mailform.php.  I searched and I searched, looking for this code called mailform.php and could not find it. Then I had an epiphany. What if the process was recursive and the file I was editing had to be called mailform.php? An hour later, after correcting errors which seemed to come out of nowhere, I got it to work.

Independent of my discussion above, is the mail which is used by my OS. I initially used sendmail, for lack of any other ideas. I got the simple mail php code working by changing the email addresses from rose@domain to rose in the code. When I typed mail at the command line, I was able to see the message after exactly one minute.  I thought this odd and searched around and tried some other things. I reached one responder who simply said, stop using sendmail and use postfix instead. The writer sounded so sure that I  just tried it and it worked. (Alas, I cannot find the link, I had on the order of 10 tags open with the same number of google search combinations). The only problem after that was to stop the sendmail process. For some reason, my tried and true "sudo kill -9 processid" refused to work. and I had to "sudo /etc/init.d/sendmail stop". 

On to security.

No comments:

Post a Comment