Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First: How do I know if my system is able to send an e-mail? Second: How do I configure if it can't send an e-mail at the moment?

Because I went to /etc/php5/apache2/php.ini and added this:

sendmail_path = "/usr/sbin/sendmail -t -i"

Then, I restarted Apache, but when I tried a simple mail, e.g

if(mail($to,$subject,$message,"FROM: $from")){
   echo "mail sent";
} else {
   echo "sending failure";

It failed, did I miss something ?

share|improve this question
It sounds like you are way in over your head and might want to consider hiring a consultant to assist you. – TylerShads Nov 20 '11 at 22:40
up vote 1 down vote accepted

You need to configure a mail server on your host. Serverfault's search yields this link which explains the procedure

share|improve this answer
how to configure that? ..on windows I only add something like this, at the php.ini file.. SMTP = smtp_port = 25 bout on linux ? – sasori Nov 20 '11 at 14:30
Have you tried doing just that on linux (php.ini should be in /etc/php5/apache2/php.ini)? Anyway, it's usually a good idea to configure a local mail server, since also other services want to use it. Usually, it's configured as a satellite system which forwards all mail to your ISPs mail server. – danimo Nov 22 '11 at 7:48
You can configure your MTA on installation (apt-get install postfix) or at anytime (dpkg-reconfigure exim4-config for exim, dpkg-reconfigure postfix for postfix, I recommend postfix). A menu will guide you through the setup process. – danimo Nov 22 '11 at 7:50
Can't add a comment to the poster below, so let me answer: as long as you are configure your mail server to forward mail to your ISP using your SMTP login credentials, the chance to be blacklisted is the same as for a direct forward. I agree howerver that correctly configuring a local mail server adds administration overhead. – danimo Dec 1 '11 at 17:24

In my experience I found maintaining a mailing server is not necessarily the best practice. It can be problematic if your server falls into blacklists etc.

I prefer using any one of free/paid mailing services available on the web instead. I use simple standalone scripts (ie: to access these services via POP/IMAP in my applications, which are also easier to configure.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.