Take the 2-minute tour ×

My os: Ubuntu 12.10

My server: Apache2.2 with PHP5 and MySQL support

my php.ini file:

; http://php.net/sendmail-path

I have sendmail installed...

but when i run this php script on my local machine:


//if "email" is filled out, send email
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  $res = mail("myemailid@gmail.com", $subject,
  $message, "From:" . $email);
      echo "Thank you for using our mail form";
      echo "Error!";
  <input type='submit'>


The page reload happens for a long time and then "Error!" is printed!

Any help guys?

share|improve this question
It makes me sad that there are over 10k php mail() questions –  Mike B May 23 '13 at 13:46
Have you gone through the usual steps? Check your logs, restart the server, etc.? –  j08691 May 23 '13 at 13:49
If you enter this command on your console : # telnet 25 ?....in case that the port 25 is fine, then try restarting apache –  Robert Rozas May 23 '13 at 13:50
yes i restarted, wait i'll check the logs @j08691 –  user2381080 May 23 '13 at 13:51
This could be due to a variety of things: sendmail not existing (it's not automatic!), spamfilter telling sendmail to GTFO due to the mail not having a To: header and being spoofed (envelope and From differ), the server's mail relay barfing up... Check mail.log and mail.err. If nothing got there, your sendmail is wrongly configured. If it got there but screwed up, your logfiles will tell you. –  Sébastien Renauld May 23 '13 at 13:51

Your Answer



Browse other questions tagged or ask your own question.