Ok, I did it. How I did it for debian squeeze with nginx server: (all the commands that I execute as root)
First of all you need to install sendmail
apt-get install sendmail
Next, you should configure this file, which was easier than I thought.
sendmailconfig
Okay, the next step I took is configuring php.ini (I'm not a great admin, I'm new, so I don't know if this is necessary or not).
I have installed
sendmail_path= /usr/sbin/sendmail -t -i
Well, from now on, theoretically, you can send emails, but for my case this led to a 504 HTTP error gateway timeout. But, as I found out much later, e-mail has already appeared in the mailbox. So my test php file:
<?php mail(' myWorkingEmail@example.com ', 'test', 'you done that'); echo 'ok';
This is pretty clear.
The next problem is error 504. I go to the log files
nano /var/log/mail.log
and here I find this error (this is not the only error, but it is responsible for error 504):
sm-msp-queue[***]: My unqualified host name (myhostname) unknown; sleeping for retry
Then, to find how I can solve this problem: http://forums.fedoraforum.org/archive/index.php/t-85365.html last comment on this page.
Or other words I made:
nano /etc/hosts
and in this file I change the order of the hosts
127.0.0.1 my_ip localhost myhostname
save, do. open your test php file, there is no 504 error, and emails are the income to send by email in the mail program. As I said, I'm a newbie and this may not work for you, but it works for me anyway. Of course, this is not the final configuration. I hope you find this helpful.