Friday, August 31, 2018

forms - PHP Email List Subscriber Script

Why won't this script work? I just want an email sent to hello@weblabcompany.com with the email of the subscriber so I can follow up with them later




Subscribe to Web Lab


Receive articles as they are published







if(isset($_POST['email'])) {


// EDIT THE 2 LINES BELOW AS REQUIRED

$email_to = "hello@weblabcompany.com";

$email_subject = "New Sub";

function died($error) {

// your error code can go here

echo "We are very sorry, but there were error(s) found with the form you submitted. ";

echo "These errors appear below.

";

echo $error."

";

echo "Please go back and fix these errors.

";

die();

}


!isset($_POST['email'])

{

died('We are sorry, but there appears to be a problem with the form you submitted.');
}



$email = $_POST['email']; // required


//$error_message = "";

//$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';

//if(!preg_match($email_exp,$email_from)) {

//$error_message .= 'The Email Address you entered does not appear to be valid.
';

//}

//$string_exp = "/^[A-Za-z .'-]+$/";

//if(!preg_match($string_exp,$name)) {

//$error_message .= 'The First Name you entered does not appear to be valid.
';

//}

//if(!preg_match($string_exp,$email)) {

//$error_message .= 'The Last Name you entered does not appear to be valid.
';

//}

//if(strlen($message) < 2) {

//$error_message .= 'The Comments you entered do not appear to be valid.
';

//}
//if(strlen($error_message) > 0) {

//died($error_message);

//}

$email_message = "Form details below.\n\n";

function clean_string($string) {

$bad = array("content-type","bcc:","to:","cc:","href");

return str_replace($bad,"",$string);

}


$email_message .= "email: ".clean_string($email)."\n";


$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' . phpversion();

@mail($email);

?>



Thank you for contacting us. We will be in touch with you very soon.


}

?>

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...