I am designing a registration system for users to my site. I want to send an HTML email to them when they register. I copied a majority of this code from another site that I did where the html mail works. This one, however, is returning false. I was hoping to get a fresh set of eyes since I'm not seeing the problem
Thanks for your help:
Sorry if tabs make it hard to read...Code:if(!$errors) { $Password = Encrypt($_POST[Password]."Caro-Kann"); $_POST[Password] = NULL; $_POST[Password2] = NULL; $First = mysql_escape_string($_POST[First]); $Last = mysql_escape_string($_POST[Last]); $Email = mysql_escape_string($_POST[Email]); $AltEmail = mysql_escape_string($_POST[AltEmail]); date_default_timezone_set("America/Denver"); $LastLogin = date("Y-m-d H:i:s",time()); $Confirmation = rand(1000,9999); $message = " <html> <head> <link rel=\"stylesheet\" type=\"text/css\" href=\"http://ucdchessclub.com/css/common.css\"> </head> <body style=\"background: black; color: white;\"> <div> <a href=\"http://ucdchessclub.com\" target=\"_blank\" style=\"float: left; margin-right: 20px; margin-bottom: 20px;\"><img src=\"http://ucdchessclub.com/images/culogo.png\" /></a> <h1>UCD Chess Club</h1> <p style=\"clear: both;\">Dear $First $Last,</p> <p>Thank you for registering an account with the UCD Chess Club!</p> <p>In order to verify your account, you will need to log in at <a href=\"http://ucdchessclub.com/signin.php\" target=\"_blank\">http://ucdchessclub.com/signin.php</a> and entering the confirmation code.</p> <p>Your confirmation code is:</p> <h3>$Confirmation</h3> <p>If you have any questions about this email, please reply. If you have difficulty confirming your email address, or you did not sign up to the UCD Chess Club, please contact <a href=\"mailto:admin@ucdchessclub.com\">admin@ucdchessclub.com</a>. </p> <p>Sincerely,</p> <p>Christofer Peterson, UCD Chess Club President</p> </div> </body> </html> "; $headers = "From: admin@ucdchessclub.com\r\n"; $headers .= "MIME_Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $subject = "UCD Chess Club Registration"; $to = "".$_POST[Email].""; if(@mail($to, $subject, $message, $headers)) { $sql = "INSERT INTO member (First,Last,Email,AltEmail,Password,LastLogin,Registered,Confirmation) VALUES ('$First','$Last','$Email','$AltEmail','$Password','$LastLogin','$LastLogin','$Confirmation')"; mysql_query($sql) or die(mysql_error()); $_SESSION['register'] = NULL; $_SESSION[error] = NULL; $_SESSION[id]=$row[id]; $_SESSION[m] = 3; /* sets confirmation message to say registration successful */ header('location: ../'.$page.''); } else { $_SESSION[e] = 3; /* sets error message to say mailing system failed. */ foreach($_POST as $key => $value) $_SESSION['register'][$key] = $value; header('location: ../register.php'); } } else { $_SESSION[e] = 2; /* sets error message to display form errors */ $_SESSION[error] = $errors; foreach($_POST as $key => $value) $_SESSION['register'][$key] = $value; header('location: ../register.php'); }


LinkBack URL
About LinkBacks

Reply With Quote

