EMail function is not working..


Record is inserting but email is not going..

if($_POST['registersubmit']) { $to="'".$_POST['email']."'"; include('db.php'); $checkemail=mysql_num_rows(mysql_query("select * from authentications where email='".$_POST['email']."'")); if($checkemail) header("Location:".$_SERVER['PHP_SELF']."?msg=E-Mail Already Exists "); else { $query="insert into authentications (password, authcode, email, status, created_at) values ('".$_POST['password']."', '".md5($_POST['email'])."', '".$_POST['email']."', 0, '".date('Y-m-d h:i:s')."')"; if(mysql_query($query)) { $headers1 = 'MIME-Version: 1.0' . "\r\n"; $headers1 .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers1 .= "From: Delhi Certificates \r\n"; $headers1 .= "Organization: Delhi Certificates\r\n"; $Subject1 = "Your account has been registered. Thank you!"; $msg=" You recently registered for Delhi Certificates using this email address. To complete your registration, follow the link below:".$_POST['email']."
                (If clicking on the link doesn't work, try copy and paste it into your browser.)
                If you did not register for, please disregard this message.
                Delhi Certificates
        //      echo $msg;
        //      echo $to, $Subject1, $msg, $headers1;
                $success = mail($to, $Subject1, $msg, $headers1);
        //      header("Location:".$_SERVER['PHP_SELF']."?msg=Email hass been sent ");

Windows or *nix? Local development, or production server? What is the value of $success ? Have you tried $to without adding the quotes? Have you tried to specify a valid from email address in the header?


Linux Environment and It is on production server..
If I use only mail function and use hard coded email in parameter then It works.
$success is not having any use..


Change to:

$to = $_POST['email'];

Adding the quotes is likely invalidating the address.


Still it is not working I tried ..

This article has been dead for over six months: Start a new discussion instead
Start New Discussion
Tags Related to this Article