php mail function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pratikpatel3675
    New Member
    • Apr 2012
    • 1

    #1

    php mail function

    Code:
    <?php
    //print_r($_REQUEST);
    $link = mysql_connect('localhost', 'root', '');
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("moes", $link);
    $confirm_code=	md5(uniqid(rand()));
    $fname=$_POST['First_Name'];
    $lname=$_POST['Last_Name'];
    $address=$_POST['Address'];
    $country=$_POST['Country'];
    $state=$_POST['State'];
    $city=$_POST['City'];
    $pincode=$_POST['Pincode'];
    $cnumber=$_POST['Contactno'];
    $gender=$_POST['Gender'];
    $birthday=$_POST['Year'].'-'.$_POST['Month'].'-'.$_POST['Day'];
    $email=$_POST['Email_Id'];
    $password1=$_POST['Password1']; 
    $encrypted_mypassword1=md5($password1);
    $password2=$_POST['Password2'];
    $encrypted_mypassword2=md5($password2);
    $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')";
    $success=mysql_query($query, $link);
    
    if($success) {
    	$to = $email;
    	$subject = 'Confirm your account with MOES';
    	$message="Your Comfirmation link \r\n";
    //	$message.="Click on this link to activate your account \r\n";
    	//$message.="http://www.example.com/confirmation.php?passkey=$confirm_code";
    	$headers = "From: sender@yourdomain.com rn";
    	$sentmail=mail($to,$subject,$message,$header);
    }
    
    if($sentmail)
    {
    	echo "your confirmaiton link has been send to your account";
    	$header = 'Location: http://localhost/client/thankyou.php';
    
    }
    
    else {
    	echo "can not send confirmation link to your account";
    }
    ?>
    i have this kind of code any one can help me why i get the error
    Warning: mail() [function.mail]: "sendmail_f rom" 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
    Last edited by PsychoCoder; Apr 22 '12, 05:11 AM. Reason: Code tags added
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    it mean open your php.ini and setup your send mail options

    Comment

    • arvind vohra
      New Member
      • Jan 2012
      • 12

      #3
      $headers = "From: sender@yourdoma in.com rn";

      $sentmail=mail( $to,$subject,$m essage,$header) ;

      you r missing s

      $sentmail=mail( $to,$subject,$m essage,$headers );

      Comment

      Working...