I have a registration form and registration code separate from the form that checks validation. In this file I want to put an email option that will send email to the user regarding their input and attache an html file to this. These are the variables that are filled in: echo $_POST["username"] . "<br />" . $_POST["email"] . "<br />" . $_POST["password"];
Can someone please help with this. I have done the following and it is not working:
//start building the mail string
$name = $_POST['username']."\n";
$email = $_POST['email']."\n";
$message = $_POST['message']."\n";
//set up the mail
$recipient = "email";
$subject = "Registration to Lets Get Started";
$mailheaders = "From:
webmaster@letsgetstarted.net63.net> \n";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
//read the atachment file contents into a string,
//encode it with MIME base64,
//and split it into smaller chunks
$attachment = chunk_split(base64_encode(file_get_contents('newaccountletter.html')));
//define the body of the message.
ob_start(); //Turn on output buffering
//send the mail
mail($recipient, $subject, $message, $mailheaders, $headers);
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
LadyDee