By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

php mail function

P: 1
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //print_r($_REQUEST);
  3. $link = mysql_connect('localhost', 'root', '');
  4. if (!$link) {
  5.     die('Could not connect: ' . mysql_error());
  6. }
  7. mysql_select_db("moes", $link);
  8. $confirm_code=    md5(uniqid(rand()));
  9. $fname=$_POST['First_Name'];
  10. $lname=$_POST['Last_Name'];
  11. $address=$_POST['Address'];
  12. $country=$_POST['Country'];
  13. $state=$_POST['State'];
  14. $city=$_POST['City'];
  15. $pincode=$_POST['Pincode'];
  16. $cnumber=$_POST['Contactno'];
  17. $gender=$_POST['Gender'];
  18. $birthday=$_POST['Year'].'-'.$_POST['Month'].'-'.$_POST['Day'];
  19. $email=$_POST['Email_Id'];
  20. $password1=$_POST['Password1']; 
  21. $encrypted_mypassword1=md5($password1);
  22. $password2=$_POST['Password2'];
  23. $encrypted_mypassword2=md5($password2);
  24. $query="INSERT INTO user_registration(first_name,last_name,address,city,state,pincode,country,contact_number,gender,date_of_birth,email_id,password1,password2) VALUES ('$fname','$lname','$address','$city','$state','$pincode','$country','$cnumber','$gender','$birthday','$email','$encrypted_mypassword1','$encrypted_mypassword2')";
  25. $success=mysql_query($query, $link);
  26.  
  27. if($success) {
  28.     $to = $email;
  29.     $subject = 'Confirm your account with MOES';
  30.     $message="Your Comfirmation link \r\n";
  31. //    $message.="Click on this link to activate your account \r\n";
  32.     //$message.="http://www.example.com/confirmation.php?passkey=$confirm_code";
  33.     $headers = "From: sender@yourdomain.com rn";
  34.     $sentmail=mail($to,$subject,$message,$header);
  35. }
  36.  
  37. if($sentmail)
  38. {
  39.     echo "your confirmaiton link has been send to your account";
  40.     $header = 'Location: http://localhost/client/thankyou.php';
  41.  
  42. }
  43.  
  44. else {
  45.     echo "can not send confirmation link to your account";
  46. }
  47. ?>
i have this kind of code any one can help me why i get the error
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\clientc\action.php on line 34
can not send confirmation link to your account
Apr 19 '12 #1
Share this Question
Share on Google+
2 Replies


100+
P: 1,059
it mean open your php.ini and setup your send mail options
Apr 19 '12 #2

P: 12
$headers = "From: sender@yourdomain.com rn";

$sentmail=mail($to,$subject,$message,$header);

you r missing s

$sentmail=mail($to,$subject,$message,$headers);
Apr 26 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.