Jump to content

PHP mail function not working


ronsebastian4
 Share

Recommended Posts

My os: Ubuntu 12.10 My server: Apache2.2 with PHP5 and MySQL support my php.ini file:

 ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").; http://php.net/sendmail-pathsendmail_path = "/usr/sbin/sendmail -t -i"

I have sendmail installed... but when i run this php script on my local machine:

<html><body> <?phpif (isset($_REQUEST['email']))//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);  if($res){      echo "Thank you for using our mail form";  }else{      echo "Error!";  }  }else//if "email" is not filled out, display the form  {  echo "<form method='post' action='mailform.php'>  Email: <input name='email' type='text'><br>  Subject: <input name='subject' type='text'><br>  Message:<br>  <textarea name='message' rows='15' cols='40'>  </textarea><br>  <input type='submit'>  </form>";  }?> </body></html>

The page reload happens for a long time and then "Error!" is printed! Any help guys?

Edited by ronsebastian4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...