#
closed
Need help with sendemail.php

I'm having issues getting the sendemail.php script to append the subject from the checkboxes in index.html to the sendemail.php script and then passed to the contact email it produces. The script itself doesn't contain the class referred to by the index and I don't know enough about PHP to write that class into the script. I have modified the script a bit so it is a bit more legible when delivered, but as it sits, it gets delivered it no subject. The script is below.

I've attached a copy of the message it delivers as well.

Any ideas?

Thanks,

Shawn

 

<?php

// Define some constants

define( "RECIPIENT_NAME", "PLBS Info" );

define( "RECIPIENT_EMAIL", "[email protected]" );


// Read the form values

$success = false;

$userName = isset( $_POST['firstname'] ) ? preg_replace( "/[^\s\S\.\-\_\@a-zA-Z0-9]/", "", $_POST['firstname'] ) : "";

$lastName = isset( $_POST['lastname'] ) ? preg_replace( "/[^\s\S\.\-\_\@a-zA-Z0-9]/", "", $_POST['lastname'] ) : "";

$senderEmail = isset( $_POST['email'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['email'] ) : "";

$userCompany = isset( $_POST['company'] ) ? preg_replace( "/[^\s\S\.\-\_\@a-zA-Z0-9]/", "", $_POST['company'] ) : "";

$message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";

$subject = isset( $_POST['subjects'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['subjects'] ) : "";

//$subject-1 = "I need help with my company billings"

//$subject = "New Email Address for Mailing List";

// If all values exist, send the email

if ( $userName && $lastName && $senderEmail && $userCompany && $message) {

  $recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">";

  $headers = "From: " . $userName . "";

  $headers = "Subject: " . $subject . "";

$msgBody =      "A visitor to the website has left you a message!  \n ".

                        " Name:  $userName $lastName \n ".

                        " Email:  $senderEmail \n ".

                        " Company:  $userCompany \n ".

                        " Message: $message \n ";  

$success = mail( $recipient, $headers, $msgBody );

  //Set Location After Successsfull Submission

  header('Location: contact.html?message=Successfull');

}

else{

        //Set Location After Unsuccesssfull Submission

        header('Location: contact.html?message=Failed');

}

?>

ATTACHED FILES

Asked 3 years ago on June 26, 2021 4:21 PM Comments 1 times


  1. Generic placeholder image

    Mridula Biswas replied

    Hi,

    Sorry about this very late reply. We didn't get this notification for some technical reason. We'll be happy to help if that still needed.

    Regards,
    designTone Support
Recent Tickets
Refund - Because it only ... 1 year ago on August 7, 2023 7:54 AM How to change the orange ... 2 years ago on June 29, 2022 4:29 PM Change on "request quote"... 2 years ago on February 26, 2022 4:14 PM text shifted when the tit... 2 years ago on February 26, 2022 1:06 PM Falha ao instalar... 3 years ago on September 21, 2021 10:44 PM Need help with sendemail.... 3 years ago on June 26, 2021 4:21 PM